< prev index next >
modules/javafx.swing/src/main/java/javafx/embed/swing/JFXPanel.java
Print this page
rev 10046 : 8166242: Removal of com.sun.javafx.embed.AbstractEvents
Reviewed-by: azvegint
*** 54,82 ****
import java.nio.IntBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.concurrent.CountDownLatch;
import javafx.application.Platform;
import javafx.scene.Scene;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import com.sun.javafx.application.PlatformImpl;
import com.sun.javafx.cursor.CursorFrame;
- import com.sun.javafx.embed.AbstractEvents;
import com.sun.javafx.embed.EmbeddedSceneInterface;
import com.sun.javafx.embed.EmbeddedStageInterface;
import com.sun.javafx.embed.HostInterface;
import com.sun.javafx.stage.EmbeddedWindow;
import com.sun.javafx.tk.Toolkit;
import com.sun.javafx.PlatformUtil;
import java.awt.event.InvocationEvent;
import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicInteger;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
import sun.java2d.SunGraphics2D;
import sun.java2d.SurfaceData;
import sun.util.logging.PlatformLogger;
--- 54,84 ----
import java.nio.IntBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.concurrent.CountDownLatch;
+ import com.sun.javafx.tk.FocusCause;
import javafx.application.Platform;
import javafx.scene.Scene;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import com.sun.javafx.application.PlatformImpl;
import com.sun.javafx.cursor.CursorFrame;
import com.sun.javafx.embed.EmbeddedSceneInterface;
import com.sun.javafx.embed.EmbeddedStageInterface;
import com.sun.javafx.embed.HostInterface;
import com.sun.javafx.stage.EmbeddedWindow;
import com.sun.javafx.tk.Toolkit;
import com.sun.javafx.PlatformUtil;
import java.awt.event.InvocationEvent;
import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicInteger;
+
+ import javafx.scene.input.ScrollEvent;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
import sun.java2d.SunGraphics2D;
import sun.java2d.SurfaceData;
import sun.util.logging.PlatformLogger;
*** 369,379 ****
if (e.getID() == MouseEvent.MOUSE_PRESSED || e.getID() == MouseEvent.MOUSE_RELEASED) {
popupTrigger = e.isPopupTrigger();
}
if(e.getID() == MouseEvent.MOUSE_WHEEL) {
! scenePeer.scrollEvent(AbstractEvents.MOUSEEVENT_VERTICAL_WHEEL,
0, -SwingEvents.getWheelRotation(e),
0, 0, // total scroll
40, 40, // multiplier
e.getX(), e.getY(),
e.getXOnScreen(), e.getYOnScreen(),
--- 371,381 ----
if (e.getID() == MouseEvent.MOUSE_PRESSED || e.getID() == MouseEvent.MOUSE_RELEASED) {
popupTrigger = e.isPopupTrigger();
}
if(e.getID() == MouseEvent.MOUSE_WHEEL) {
! scenePeer.scrollEvent(ScrollEvent.SCROLL,
0, -SwingEvents.getWheelRotation(e),
0, 0, // total scroll
40, 40, // multiplier
e.getX(), e.getY(),
e.getXOnScreen(), e.getYOnScreen(),
*** 452,465 ****
char[] chars = (e.getKeyChar() == KeyEvent.CHAR_UNDEFINED)
? new char[] {}
: new char[] { SwingEvents.keyCharToEmbedKeyChar(e.getKeyChar()) };
scenePeer.keyEvent(
SwingEvents.keyIDToEmbedKeyType(e.getID()),
e.getKeyCode(), chars,
! SwingEvents.keyModifiersToEmbedKeyModifiers(e.getModifiersEx()));
}
/**
* Overrides the {@link java.awt.Component#processKeyEvent(KeyEvent)}
* method to dispatch the key event to the JavaFX scene attached to this
--- 454,471 ----
char[] chars = (e.getKeyChar() == KeyEvent.CHAR_UNDEFINED)
? new char[] {}
: new char[] { SwingEvents.keyCharToEmbedKeyChar(e.getKeyChar()) };
+ int extModifiers = e.getModifiersEx();
scenePeer.keyEvent(
SwingEvents.keyIDToEmbedKeyType(e.getID()),
e.getKeyCode(), chars,
! (extModifiers & InputEvent.SHIFT_DOWN_MASK) != 0,
! (extModifiers & InputEvent.CTRL_DOWN_MASK) != 0,
! (extModifiers & InputEvent.ALT_DOWN_MASK) != 0,
! (extModifiers & InputEvent.META_DOWN_MASK) != 0);
}
/**
* Overrides the {@link java.awt.Component#processKeyEvent(KeyEvent)}
* method to dispatch the key event to the JavaFX scene attached to this
*** 600,622 ****
if ((stage == null) || (stagePeer == null) || !isFxEnabled()) {
return;
}
boolean focused = (e.getID() == FocusEvent.FOCUS_GAINED);
! int focusCause = (focused ? AbstractEvents.FOCUSEVENT_ACTIVATED :
! AbstractEvents.FOCUSEVENT_DEACTIVATED);
// FIXME: JDK-8156592 -- replace this with FocusEvent.getCause()
// which is now public API, once we update to using a newer JDK.
// NOTE: the focusCause is unused at present.
/*
if (focused && (e instanceof CausedFocusEvent)) {
CausedFocusEvent ce = (CausedFocusEvent) e;
if (ce.getCause() == CausedFocusEvent.Cause.TRAVERSAL_FORWARD) {
! focusCause = AbstractEvents.FOCUSEVENT_TRAVERSED_FORWARD;
} else if (ce.getCause() == sun.awt.CausedFocusEvent.Cause.TRAVERSAL_BACKWARD) {
! focusCause = AbstractEvents.FOCUSEVENT_TRAVERSED_BACKWARD;
}
}
*/
stagePeer.setFocused(focused, focusCause);
}
--- 606,629 ----
if ((stage == null) || (stagePeer == null) || !isFxEnabled()) {
return;
}
boolean focused = (e.getID() == FocusEvent.FOCUS_GAINED);
!
! FocusCause focusCause = (focused ? FocusCause.ACTIVATED:
! FocusCause.DEACTIVATED);
// FIXME: JDK-8156592 -- replace this with FocusEvent.getCause()
// which is now public API, once we update to using a newer JDK.
// NOTE: the focusCause is unused at present.
/*
if (focused && (e instanceof CausedFocusEvent)) {
CausedFocusEvent ce = (CausedFocusEvent) e;
if (ce.getCause() == CausedFocusEvent.Cause.TRAVERSAL_FORWARD) {
! focusCause = FocusCause.TRAVERSED_FORWARD;
} else if (ce.getCause() == sun.awt.CausedFocusEvent.Cause.TRAVERSAL_BACKWARD) {
! focusCause = FocusCause.TRAVERSED_BACKWARD;
}
}
*/
stagePeer.setFocused(focused, focusCause);
}
*** 902,912 ****
if (pWidth > 0 && pHeight > 0) {
stagePeer.setSize(pWidth, pHeight);
}
invokeOnClientEDT(() -> {
if (JFXPanel.this.isFocusOwner()) {
! stagePeer.setFocused(true, AbstractEvents.FOCUSEVENT_ACTIVATED);
}
});
sendMoveEventToFX();
}
--- 909,919 ----
if (pWidth > 0 && pHeight > 0) {
stagePeer.setSize(pWidth, pHeight);
}
invokeOnClientEDT(() -> {
if (JFXPanel.this.isFocusOwner()) {
! stagePeer.setFocused(true, FocusCause.ACTIVATED);
}
});
sendMoveEventToFX();
}
< prev index next >