< prev index next >
modules/swing/src/main/java/javafx/embed/swing/SwingCursors.java
Print this page
*** 31,41 ****
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import com.sun.javafx.cursor.CursorFrame;
import com.sun.javafx.cursor.ImageCursorFrame;
- import javafx.scene.image.Image;
/**
* An utility class to translate cursor types between embedded
* application and Swing.
*
--- 31,40 ----
*** 52,62 ****
double scaledHotspotX = cursorFrame.getHotspotX() * nativeSize.getWidth() / imageWidth;
double scaledHotspotY = cursorFrame.getHotspotY() * nativeSize.getHeight() / imageHeight;
Point hotspot = new Point((int)scaledHotspotX, (int)scaledHotspotY);
BufferedImage awtImage = SwingFXUtils.fromFXImage(
! Image.impl_fromPlatformImage(cursorFrame.getPlatformImage()), null);
return awtToolkit.createCustomCursor(awtImage, hotspot, null);
}
static Cursor embedCursorToCursor(CursorFrame cursorFrame) {
switch (cursorFrame.getCursorType()) {
--- 51,61 ----
double scaledHotspotX = cursorFrame.getHotspotX() * nativeSize.getWidth() / imageWidth;
double scaledHotspotY = cursorFrame.getHotspotY() * nativeSize.getHeight() / imageHeight;
Point hotspot = new Point((int)scaledHotspotX, (int)scaledHotspotY);
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()) {
< prev index next >