< prev index next >
modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/SwingEvents.java
Print this page
@@ -21,11 +21,11 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package javafx.embed.swing;
+package com.sun.javafx.embed.swing;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
@@ -36,13 +36,13 @@
/**
* A utility class to translate event types and data between embedded
* application and Swing.
*/
-class SwingEvents {
+public class SwingEvents {
- static int mouseIDToEmbedMouseType(int id) {
+ public static int mouseIDToEmbedMouseType(int id) {
switch (id) {
case MouseEvent.MOUSE_PRESSED:
return AbstractEvents.MOUSEEVENT_PRESSED;
case MouseEvent.MOUSE_RELEASED:
return AbstractEvents.MOUSEEVENT_RELEASED;
@@ -58,11 +58,11 @@
return AbstractEvents.MOUSEEVENT_EXITED;
}
return 0;
}
- static int mouseButtonToEmbedMouseButton(int button, int extModifiers) {
+ public static int mouseButtonToEmbedMouseButton(int button, int extModifiers) {
int abstractButton = AbstractEvents.MOUSEEVENT_NONE_BUTTON;
switch (button) {
case MouseEvent.BUTTON1:
abstractButton = AbstractEvents.MOUSEEVENT_PRIMARY_BUTTON;
break;
@@ -84,18 +84,18 @@
abstractButton = AbstractEvents.MOUSEEVENT_SECONDARY_BUTTON;
}
return abstractButton;
}
- static int getWheelRotation(MouseEvent e) {
+ public static int getWheelRotation(MouseEvent e) {
if (e instanceof MouseWheelEvent) {
return ((MouseWheelEvent)e).getWheelRotation();
}
return 0;
}
- static int keyIDToEmbedKeyType(int id) {
+ public static int keyIDToEmbedKeyType(int id) {
switch (id) {
case KeyEvent.KEY_PRESSED:
return AbstractEvents.KEYEVENT_PRESSED;
case KeyEvent.KEY_RELEASED:
return AbstractEvents.KEYEVENT_RELEASED;
@@ -103,11 +103,11 @@
return AbstractEvents.KEYEVENT_TYPED;
}
return 0;
}
- static int keyModifiersToEmbedKeyModifiers(int extModifiers) {
+ public static int keyModifiersToEmbedKeyModifiers(int extModifiers) {
int embedModifiers = 0;
if ((extModifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
embedModifiers |= AbstractEvents.MODIFIER_SHIFT;
}
if ((extModifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
@@ -120,18 +120,18 @@
embedModifiers |= AbstractEvents.MODIFIER_META;
}
return embedModifiers;
}
- static char keyCharToEmbedKeyChar(char ch) {
+ public static char keyCharToEmbedKeyChar(char ch) {
// Convert Swing LF character to Fx CR character.
return ch == '\n' ? '\r' : ch;
}
// FX -> Swing conversion methods
- static int fxMouseEventTypeToMouseID(javafx.scene.input.MouseEvent event) {
+ public static int fxMouseEventTypeToMouseID(javafx.scene.input.MouseEvent event) {
EventType<?> type = event.getEventType();
if (type == javafx.scene.input.MouseEvent.MOUSE_MOVED) {
return MouseEvent.MOUSE_MOVED;
}
if (type == javafx.scene.input.MouseEvent.MOUSE_PRESSED) {
@@ -156,11 +156,11 @@
return -1;
}
throw new RuntimeException("Unknown MouseEvent type: " + type);
}
- static int fxMouseModsToMouseMods(javafx.scene.input.MouseEvent event) {
+ public static int fxMouseModsToMouseMods(javafx.scene.input.MouseEvent event) {
int mods = 0;
if (event.isAltDown()) {
mods |= InputEvent.ALT_DOWN_MASK;
}
if (event.isControlDown()) {
@@ -182,11 +182,11 @@
mods |= MouseEvent.BUTTON2_DOWN_MASK;
}
return mods;
}
- static int fxMouseButtonToMouseButton(javafx.scene.input.MouseEvent event) {
+ public static int fxMouseButtonToMouseButton(javafx.scene.input.MouseEvent event) {
switch (event.getButton()) {
case PRIMARY:
return MouseEvent.BUTTON1;
case SECONDARY:
return MouseEvent.BUTTON3;
@@ -194,11 +194,11 @@
return MouseEvent.BUTTON2;
}
return 0;
}
- static int fxKeyEventTypeToKeyID(javafx.scene.input.KeyEvent event) {
+ public static int fxKeyEventTypeToKeyID(javafx.scene.input.KeyEvent event) {
EventType<?> eventType = event.getEventType();
if (eventType == javafx.scene.input.KeyEvent.KEY_PRESSED) {
return KeyEvent.KEY_PRESSED;
}
if (eventType == javafx.scene.input.KeyEvent.KEY_RELEASED) {
@@ -208,11 +208,11 @@
return KeyEvent.KEY_TYPED;
}
throw new RuntimeException("Unknown KeyEvent type: " + eventType);
}
- static int fxKeyModsToKeyMods(javafx.scene.input.KeyEvent event) {
+ public static int fxKeyModsToKeyMods(javafx.scene.input.KeyEvent event) {
int mods = 0;
if (event.isAltDown()) {
mods |= InputEvent.ALT_DOWN_MASK;
}
if (event.isControlDown()) {
@@ -225,11 +225,11 @@
mods |= InputEvent.SHIFT_DOWN_MASK;
}
return mods;
}
- static int fxScrollModsToMouseWheelMods(ScrollEvent event) {
+ public static int fxScrollModsToMouseWheelMods(ScrollEvent event) {
int mods = 0;
if (event.isAltDown()) {
mods |= InputEvent.ALT_DOWN_MASK;
}
if (event.isControlDown()) {
< prev index next >