< prev index next >
modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/SwingCursors.java
Print this page
*** 21,47 ****
* 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;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import com.sun.javafx.cursor.CursorFrame;
import com.sun.javafx.cursor.ImageCursorFrame;
/**
* An utility class to translate cursor types between embedded
* application and Swing.
*
*/
! class SwingCursors {
private static Cursor createCustomCursor(ImageCursorFrame cursorFrame) {
Toolkit awtToolkit = Toolkit.getDefaultToolkit();
double imageWidth = cursorFrame.getWidth();
--- 21,49 ----
* 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 com.sun.javafx.embed.swing;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import com.sun.javafx.cursor.CursorFrame;
import com.sun.javafx.cursor.ImageCursorFrame;
+ import javafx.embed.swing.SwingFXUtils;
+
/**
* An utility class to translate cursor types between embedded
* application and Swing.
*
*/
! public class SwingCursors {
private static Cursor createCustomCursor(ImageCursorFrame cursorFrame) {
Toolkit awtToolkit = Toolkit.getDefaultToolkit();
double imageWidth = cursorFrame.getWidth();
*** 55,65 ****
BufferedImage awtImage = SwingFXUtils.fromFXImage(
com.sun.javafx.tk.Toolkit.getImageAccessor().fromPlatformImage(cursorFrame.getPlatformImage()), null);
return awtToolkit.createCustomCursor(awtImage, hotspot, null);
}
! static Cursor embedCursorToCursor(CursorFrame cursorFrame) {
switch (cursorFrame.getCursorType()) {
case DEFAULT:
return Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
case CROSSHAIR:
return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
--- 57,67 ----
BufferedImage awtImage = SwingFXUtils.fromFXImage(
com.sun.javafx.tk.Toolkit.getImageAccessor().fromPlatformImage(cursorFrame.getPlatformImage()), null);
return awtToolkit.createCustomCursor(awtImage, hotspot, null);
}
! public static Cursor embedCursorToCursor(CursorFrame cursorFrame) {
switch (cursorFrame.getCursorType()) {
case DEFAULT:
return Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
case CROSSHAIR:
return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
*** 101,111 ****
}
return Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
}
! static javafx.scene.Cursor embedCursorToCursor(Cursor cursor) {
if (cursor == null) {
return javafx.scene.Cursor.DEFAULT;
}
switch (cursor.getType()) {
--- 103,113 ----
}
return Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
}
! public static javafx.scene.Cursor embedCursorToCursor(Cursor cursor) {
if (cursor == null) {
return javafx.scene.Cursor.DEFAULT;
}
switch (cursor.getType()) {
< prev index next >