< prev index next >

modules/graphics/src/main/java/javafx/scene/ImageCursor.java

Print this page




 279                     imageCursor, images, hotspotX, hotspotY);
 280         } else {
 281             imageCursor.initialize(images, hotspotX, hotspotY);
 282         }
 283 
 284         return imageCursor;
 285     }
 286 
 287     @Override CursorFrame getCurrentFrame() {
 288         if (currentCursorFrame != null) {
 289             return currentCursorFrame;
 290         }
 291 
 292         final Image cursorImage = getImage();
 293 
 294         if (cursorImage == null) {
 295             currentCursorFrame = Cursor.DEFAULT.getCurrentFrame();
 296             return currentCursorFrame;
 297         }
 298 
 299         final Object cursorPlatformImage = cursorImage.impl_getPlatformImage();
 300         if (cursorPlatformImage == null) {
 301             currentCursorFrame = Cursor.DEFAULT.getCurrentFrame();
 302             return currentCursorFrame;
 303         }
 304 
 305         if (firstCursorFrame == null) {
 306             firstCursorFrame =
 307                     new ImageCursorFrame(cursorPlatformImage,
 308                                          cursorImage.getWidth(),
 309                                          cursorImage.getHeight(),
 310                                          getHotspotX(),
 311                                          getHotspotY());
 312             currentCursorFrame = firstCursorFrame;
 313         } else if (firstCursorFrame.getPlatformImage() == cursorPlatformImage) {
 314             currentCursorFrame = firstCursorFrame;
 315         } else {
 316             if (otherCursorFrames == null) {
 317                 otherCursorFrames = new HashMap<Object, ImageCursorFrame>();
 318             }
 319 




 279                     imageCursor, images, hotspotX, hotspotY);
 280         } else {
 281             imageCursor.initialize(images, hotspotX, hotspotY);
 282         }
 283 
 284         return imageCursor;
 285     }
 286 
 287     @Override CursorFrame getCurrentFrame() {
 288         if (currentCursorFrame != null) {
 289             return currentCursorFrame;
 290         }
 291 
 292         final Image cursorImage = getImage();
 293 
 294         if (cursorImage == null) {
 295             currentCursorFrame = Cursor.DEFAULT.getCurrentFrame();
 296             return currentCursorFrame;
 297         }
 298 
 299         final Object cursorPlatformImage = Toolkit.getImageAccessor().getPlatformImage(cursorImage);
 300         if (cursorPlatformImage == null) {
 301             currentCursorFrame = Cursor.DEFAULT.getCurrentFrame();
 302             return currentCursorFrame;
 303         }
 304 
 305         if (firstCursorFrame == null) {
 306             firstCursorFrame =
 307                     new ImageCursorFrame(cursorPlatformImage,
 308                                          cursorImage.getWidth(),
 309                                          cursorImage.getHeight(),
 310                                          getHotspotX(),
 311                                          getHotspotY());
 312             currentCursorFrame = firstCursorFrame;
 313         } else if (firstCursorFrame.getPlatformImage() == cursorPlatformImage) {
 314             currentCursorFrame = firstCursorFrame;
 315         } else {
 316             if (otherCursorFrames == null) {
 317                 otherCursorFrames = new HashMap<Object, ImageCursorFrame>();
 318             }
 319 


< prev index next >