setSceneCursor(parentScene, Cursor.WAIT); above code to call the below method.. we can have below method in common place and we can access that code from anywhere if we can access class of below method public void setSceneCursor(Scene scene,Cursor cv) { scene.setCursor(cv); }
cursorEvent = Cursor.DEFAULT; scene.setCursor(cursorEvent); } else if(MouseEvent.MOUSE_EXITED.equals(mouseEventType) || MouseEvent.MOUSE_EXITED_TARGET.equals(mouseEventType)){ scene.setCursor(Cursor.DEFAULT); } else if (MouseEvent.MOUSE_PRESSED.equals(mouseEventType) == true) { startX = stage.getWidth() - mouseEventX;
VBox vBoxMainLayout = new VBox(); Scene scene = new Scene(vBoxMainLayout); Image img = newImage(getClass().getResourceAsStream("image.png")); ImageCursor cursor = new ImageCursor(img, 30, 30); scene.setCursor(cursor);
public void showCursor() { canvas.getScene().setCursor(lastCursor); }
public void setCursor(int kind) { Cursor c; switch (kind) { case PConstants.ARROW: c = Cursor.DEFAULT; break; case PConstants.CROSS: c = Cursor.CROSSHAIR; break; case PConstants.HAND: c = Cursor.HAND; break; case PConstants.MOVE: c = Cursor.MOVE; break; case PConstants.TEXT: c = Cursor.TEXT; break; case PConstants.WAIT: c = Cursor.WAIT; break; default: c = Cursor.DEFAULT; break; } lastCursor = c; canvas.getScene().setCursor(c); }
public void hideCursor() { canvas.getScene().setCursor(Cursor.NONE); }
void method() { Scene scene = app.getPrimaryStage().getScene(); Task<Void> task = new Task<Void>() { @Override public void call() throws Exception { // Simulate execution of code that takes some time Thread.sleep(3000); return null ; } }; task.setOnSucceeded(e -> { scene.getRoot().setDisable(false); scene.setCursor(Cursor.DEFAULT); }); scene.getRoot().setDisable(true); scene.setCursor(Cursor.WAIT); Thread t = new Thread(task); t.setDaemon(true); t.start(); }
public class cursor extends Application { @Override public void start(Stage primaryStage) { HBox root = new HBox(); Scene scene = new Scene(root); scene.setCursor(Cursor.NONE); primaryStage.setScene(scene); primaryStage.setWidth(300); primaryStage.setHeight(300); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
@Override public void blockMainWindow(final boolean blockWindow) { final Stage primaryStage = getPrimaryStage(); final EventDispatcher currentEventDispatcher = primaryStage.getEventDispatcher(); if (blockWindow) { if (currentEventDispatcher != blockingEventDispatcher) { primaryStageEventDispatcher = currentEventDispatcher; primaryStage.setEventDispatcher(blockingEventDispatcher); } } else { if (currentEventDispatcher == blockingEventDispatcher) { primaryStage.setEventDispatcher(primaryStageEventDispatcher); } } primaryStage.getScene().setCursor(blockWindow ? Cursor.WAIT : Cursor.DEFAULT); } }
public void setCursor(PImage image, int hotspotX, int hotspotY) { int w = image.pixelWidth; int h = image.pixelHeight; WritableImage im = new WritableImage(w, h); im.getPixelWriter().setPixels(0, 0, w, h, PixelFormat.getIntArgbInstance(), image.pixels, 0, w); ImageCursor c = new ImageCursor(im, hotspotX, hotspotY); lastCursor = c; canvas.getScene().setCursor(c); }
cursorEvent = Cursor.DEFAULT; scene.setCursor(cursorEvent); } else if (MouseEvent.MOUSE_EXITED.equals(mouseEventType) || MouseEvent.MOUSE_EXITED_TARGET.equals(mouseEventType)) { scene.setCursor(Cursor.DEFAULT); } else if (MouseEvent.MOUSE_PRESSED.equals(mouseEventType) == true) { startX = stage.getWidth() - mouseEventX;
scene.setCursor(Cursor.MOVE); initialX = (int) (stage.getX() - m.getScreenX()); initialY = (int) (stage.getY() - m.getScreenY());
scene.setCursor(Cursor.MOVE); initialX = (int) (stage.getX() - m.getScreenX()); initialY = (int) (stage.getY() - m.getScreenY());