@Override public void start(Stage primaryStage) throws Exception { primaryStage.setOnShowing(event -> uiHandlers.onShow()); BorderPane border = new BorderPane(); hbox = new HBox(); border.setTop(hbox); hbox.setMinHeight(60); hbox.setAlignment(Pos.CENTER_LEFT); hbox.setBackground(new Background(new BackgroundFill(Color.web("#2196f3"), CornerRadii.EMPTY, Insets.EMPTY))); hbox.setPadding(new Insets(10)); menu = new VBox(); menu.setPadding(new Insets(20, 0, 0, 0)); BorderStroke borderStroke = new BorderStroke(Color.GRAY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(0,1,0,0)); menu.setBorder(new Border(borderStroke)); menu.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY))); menu.setMinWidth(50); menu.setSpacing(20); border.setLeft(menu); primaryStage.setTitle("Todo list"); Text text = new Text("Todo List"); text.setFill(Color.WHITE); text.setFont(Font.font("Verdana", FontWeight.BOLD, 25)); center = new VBox(); center.setPadding(new Insets(20)); center.setSpacing(10); Image image = new Image(getClass().getResourceAsStream("/add.png")); Button add = new Button("", new ImageView(image)); add.setCursor(Cursor.HAND); add.setBackground(Background.EMPTY); add.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE); add.setOnAction(event -> uiHandlers.onCreate()); border.setCenter(center); hbox.setPadding(new Insets(10, 10, 10, 10)); final Pane spacer = new Pane(); HBox.setHgrow(spacer, Priority.ALWAYS); spacer.setMinSize(10, 1); hbox.getChildren().addAll(text, spacer, add); primaryStage.setScene(new Scene(border, 500, 500)); primaryStage.show(); }
public boolean createDocument(String path) { try { Start.getScene().setCursor(Cursor.WAIT); Document document = new Document(PageSize.A4); PdfWriter.getInstance(document, new FileOutputStream(path + CommonUtils.DELIMITER + "Resume candidates list. Created by RecruiterVision [" + dateFormat.format(new Date()) + "].pdf")); document.open(); addMetaData(document); addContent(document); document.close(); logger.info("Data saved to candidates list file"); Start.getScene().setCursor(Cursor.DEFAULT); return true; } catch (DocumentException | IOException e) { e.printStackTrace(); return false; } }
@Override public void addMenuItem(LayoutContext.LayoutMenuItem layoutMenuItem) { Image image = new Image(getClass().getResourceAsStream("/" + layoutMenuItem.icon() + ".png")); Button item = new Button("", new ImageView(image)); item.setTooltip(new Tooltip(layoutMenuItem.text())); item.setCursor(Cursor.HAND); item.setBackground(Background.EMPTY); item.setMinWidth(menu.getMinWidth()); item.setOnAction(event -> layoutMenuItem.selectHandler().onSelect()); menu.getChildren().add(item); }
public void setImages(List<Image> images, ImageClickHandler handler) throws IOException { grid.clear(); for (Image image : images) { ImageView imageView = grid.addImage(image.getThumbnailPath()); if(imageView == null) continue; // toolTipProvider.setToolTip(imageView, image); toolTipProvider.setPopOver(imageView, image); imageView.setOnMouseClicked(eventHandlerFactory.createFrom(image, handler)); imageView.setOnMouseEntered(event -> getScene().setCursor(Cursor.HAND)); imageView.setOnMouseExited(event -> getScene().setCursor(Cursor.DEFAULT)); } }
@Override public void seriesLegendLabelCustomAction(Data t, Node u) { u.setOnMouseEntered(ev -> { u.setCursor(Cursor.HAND); }); u.setOnMouseExited(ev -> { u.setCursor(Cursor.DEFAULT); }); u.setOnMouseClicked(ev -> { ListView<RuleViolation> lvViolation = this.checkedListComposite.getLvViolation(); ObservableList<RuleViolation> items = lvViolation.getItems(); ObservableList<RuleViolation> violationList = this.checkedListComposite.getViolationList(); List<RuleViolation> collect = violationList.stream().filter(ruleViolationFilter()) .filter(v -> ValueUtil.equals(t.getName(), ValueUtil.getSimpleFileName(v.getFilename()))).collect(Collectors.toList()); items.setAll(collect); }); }
private void initializeOperationOrFunctionListViews() { operationsListView.setStyle(SquidUI.EXPRESSION_LIST_CSS_STYLE_SPECS); operationsListView.setCursor(Cursor.CLOSED_HAND); operationsListView.setCellFactory(new StringCellFactory(dragOperationOrFunctionSource)); mathFunctionsListView.setStyle(SquidUI.EXPRESSION_LIST_CSS_STYLE_SPECS); mathFunctionsListView.setCursor(Cursor.CLOSED_HAND); mathFunctionsListView.setCellFactory(new StringCellFactory(dragOperationOrFunctionSource)); squidFunctionsListView.setStyle(SquidUI.EXPRESSION_LIST_CSS_STYLE_SPECS); squidFunctionsListView.setCursor(Cursor.CLOSED_HAND); squidFunctionsListView.setCellFactory(new StringCellFactory(dragOperationOrFunctionSource)); constantsListView.setStyle(SquidUI.EXPRESSION_LIST_CSS_STYLE_SPECS); constantsListView.setCursor(Cursor.CLOSED_HAND); constantsListView.setCellFactory(new StringCellFactory(dragOperationOrFunctionSource)); populateOperationOrFunctionListViews(); }
public Thumb2CodeArea() { getStylesheets().clear(); getStylesheets().add(Thumb2CodeArea.class.getClassLoader() .getResource("styles/thumb2-syntax-highlight.css").toExternalForm()); getStylesheets().add(Thumb2CodeArea.class.getClassLoader() .getResource("styles/spellchecking.css").toExternalForm()); setCursor(Cursor.TEXT); richChanges().filter(ch -> !ch.getInserted().equals(ch.getRemoved())) .subscribe(change -> { SyntaxHighlighter syntaxHighlighter = new SyntaxHighlighter(); setStyleSpans(0, syntaxHighlighter.highlight(getText())); }); addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent e) -> { if(e.getCode() == KeyCode.TAB) { String s = " "; insertText(getCaretPosition(), s); e.consume(); } }); }
private void setupBox(VBox box, String labelString, VBox content) { final HBox boxLabel = new HBox(); final Polygon arrow = new Polygon(2.5, 10, 10, 5, 2.5, 0); final Label label = new Label(labelString); boxLabel.setBackground(HEADER_BACKGROUND); label.setFont(GROUP_FONT); HBox.setMargin(arrow, HALF_MARGIN_INSETS); boxLabel.setAlignment(Pos.CENTER_LEFT); boxLabel.getChildren().addAll(arrow, label); boxLabel.setCursor(Cursor.HAND); box.getChildren().add(boxLabel); boxLabel.setOnMouseClicked(e -> { if (box.getChildren().size() > 1) { box.getChildren().remove(content); arrow.setRotate(0); } else { box.getChildren().add(content); arrow.setRotate(90); } }); }
private ImageView createIv(double x, double y) { ImageView iv = new ImageView(); iv.setImage(image); iv.setSmooth(true); iv.setPickOnBounds(true); iv.setCache(true); iv.setX(x); iv.setY(y); iv.setCursor(Cursor.HAND); iv.setOnMouseDragged((t) -> { ImageView i = (ImageView) (t.getSource()); i.setX(t.getSceneX()-size/2); i.setY(t.getSceneY()-size/2); }); iv.setOnMouseReleased((t) -> { double newX = t.getSceneX(); double newY = t.getSceneY(); if(zones.isInZone(newX, newY, type)) { iv.setVisible(false); } }); return iv; }
private void mouseReleased(MouseEvent event) { if (!dragging) { return; } dragging = false; tile.setCursor(Cursor.DEFAULT); resizeLocation = ResizeLocation.NONE; TileSize size = finalSize(); tile.setSize(size); GridPane.setColumnSpan(tile, size.getWidth()); GridPane.setRowSpan(tile, size.getHeight()); tilePane.setHighlight(false); ResizeUtils.setCurrentTile(null); }
/** * * @param primaryStage */ @Override public void start(Stage primaryStage) { gameManager = new GameManager(); gameBounds = gameManager.getLayoutBounds(); StackPane root = new StackPane(gameManager); root.getStyleClass().addAll("game-root"); ChangeListener<Number> resize = (ov, v, v1) -> { double scale = Math.min((root.getWidth() - MARGIN) / gameBounds.getWidth(), (root.getHeight() - MARGIN) / gameBounds.getHeight()); gameManager.setScale(scale); gameManager.setLayoutX((root.getWidth() - gameBounds.getWidth()) / 2d); gameManager.setLayoutY((root.getHeight() - gameBounds.getHeight()) / 2d); }; root.widthProperty().addListener(resize); root.heightProperty().addListener(resize); Scene scene = new Scene(root); scene.getStylesheets().add(CSS); addKeyHandler(scene); addSwipeHandlers(scene); if (isARMDevice()) { primaryStage.setFullScreen(true); primaryStage.setFullScreenExitHint(""); } if (Platform.isSupported(ConditionalFeature.INPUT_TOUCH)) { scene.setCursor(Cursor.NONE); } Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds(); double factor = Math.min(visualBounds.getWidth() / (gameBounds.getWidth() + MARGIN), visualBounds.getHeight() / (gameBounds.getHeight() + MARGIN)); primaryStage.setTitle("2048FX"); primaryStage.setScene(scene); primaryStage.setMinWidth(gameBounds.getWidth() / 2d); primaryStage.setMinHeight(gameBounds.getHeight() / 2d); primaryStage.setWidth((gameBounds.getWidth() + MARGIN) * factor); primaryStage.setHeight((gameBounds.getHeight() + MARGIN) * factor); primaryStage.show(); }
/** * Handles the 'Mark all as read' button event */ public void handleMarkAll() { Notification[] nots = MainController.getSPC().getPlanner().getUnreadNotifications(); // Mark all notifications as read: for (int i = 0; i < nots.length; ++i) { int index = this.notificationList.getChildren().size() - 1 - i; nots[i].read(); // Remove cursor: if (nots[i].getLink() == null) this.notificationList.getChildren().get(index).setCursor(Cursor.DEFAULT); // Change style: this.notificationList.getChildren().get(index).getStyleClass().remove("unread-item"); } // Handle styles: this.showNotification.getStyleClass().remove("unread-button"); if (!this.showNotification.getStyleClass().contains("read-button")) this.showNotification.getStyleClass().add("read-button"); }
@Override public void parseAllFiles(List<File> files) { new Thread(() -> { if (files.size() > 0) { Start.getScene().setCursor(Cursor.WAIT); for (File file : files) { parse(file); } Start.getScene().setCursor(Cursor.DEFAULT); if (props.isAUTO_EXECUTION()) { logger.info("Auto execution started"); gateService.executeController(); gateService.extractData(); } } }).start(); }
@Override public void extractData() { long startTime = System.nanoTime(); for (Document document : corpus) { fillCVdata(document); } long endTime = System.nanoTime(); Platform.runLater(() -> { NotificationController notification = new NotificationController("All files extracted", "Now you can check content of all CV files or create candidates list", Notifications.SUCCESS); notification.setAnimation(Animations.POPUP); notification.showAndDismiss(Duration.seconds(5)); }); Start.getScene().setCursor(Cursor.DEFAULT); logger.info("Execution time: " + (endTime - startTime) + " [ns]"); logger.info("Data extracted"); filedRepository.refreshFiledRepository(); }
@Override public void initialize(URL location, ResourceBundle resources) { // TODO Auto-generated method stub /* Drag and Drop */ borderPane.setOnMousePressed(event -> { xOffset = getLocalStage().getX() - event.getScreenX(); yOffset = getLocalStage().getY() - event.getScreenY(); borderPane.setCursor(Cursor.CLOSED_HAND); }); borderPane.setOnMouseDragged(event -> { getLocalStage().setX(event.getScreenX() + xOffset); getLocalStage().setY(event.getScreenY() + yOffset); }); borderPane.setOnMouseReleased(event -> { borderPane.setCursor(Cursor.DEFAULT); }); //设置图标 setIcon("images/icon_chatroom.png"); }
public ResizerPane(Supplier<Node> nodeSupplier) { setCursor(Cursor.N_RESIZE); setHeight(5); setOnMousePressed(event -> { startY = event.getScreenY(); startHeight = ((Region) nodeSupplier.get()).getHeight(); //System.out.println("started at " + startY + " " + startHeight); }); setOnMouseDragged(event -> { event.consume(); double diff = event.getScreenY() - startY; //System.out.println("DIFF" + diff + " " + startHeight + diff); ((Region) nodeSupplier.get()).setPrefHeight(startHeight + diff); }); }
/** * Handle starting dragging. */ private void startDrag(@NotNull final MouseEvent mouseEvent) { final TreeNode<?> item = getItem(); if (item == null) return; final TreeView<TreeNode<?>> treeView = getTreeView(); final TreeItem<TreeNode<?>> treeItem = findItemForValue(treeView, item); if (treeView.getRoot() == treeItem) return; TransferMode transferMode = item.canMove() ? TransferMode.MOVE : null; transferMode = item.canCopy() && mouseEvent.isControlDown() ? TransferMode.COPY : transferMode; if (transferMode == null) return; final Dragboard dragBoard = startDragAndDrop(transferMode); final ClipboardContent content = new ClipboardContent(); content.put(DATA_FORMAT, item.getObjectId()); dragBoard.setContent(content); dragged.setValue(true); setCursor(Cursor.MOVE); mouseEvent.consume(); }
/** * Handle start drag events. * * @param mouseEvent the mouse event. */ @FXThread private void handleStartDragEvent(@NotNull final MouseEvent mouseEvent) { startFullDrag(); final ResourceElement item = getItem(); if (item == null) return; final Path file = item.getFile(); if (!Files.exists(file)) return; final Dragboard dragBoard = startDragAndDrop(TransferMode.COPY); final ClipboardContent content = new ClipboardContent(); content.put(DataFormat.FILES, singletonList(file.toFile())); dragBoard.setContent(content); setCursor(Cursor.MOVE); mouseEvent.consume(); }
private void initUi() { root.getStyleClass().add(STYLE_CLASS); root.setManaged(false); rectangle.getStyleClass().add(RECTANGLE_STYLE_CLASS); rectangle.setMouseTransparent(true); rectangle.layoutXProperty().bind(x.subtract(RESIZER_OFFSET)); rectangle.layoutYProperty().bind(y.subtract(RESIZER_OFFSET)); rectangle.widthProperty().bind(width.add(2 * RESIZER_OFFSET)); rectangle.heightProperty().bind(height.add(2 * RESIZER_OFFSET)); resizers.layoutXProperty().bind(rectangle.layoutXProperty()); resizers.layoutYProperty().bind(rectangle.layoutYProperty()); resizers.widthProperty().bind(rectangle.widthProperty()); resizers.heightProperty().bind(rectangle.heightProperty()); resizers.getChildrenUnmodifiable().forEach(c -> c.setPickOnBounds(true)); resizers.getTopLeft().setCursor(Cursor.NW_RESIZE); resizers.getTop().setCursor(Cursor.N_RESIZE); resizers.getTopRight().setCursor(Cursor.NE_RESIZE); resizers.getRight().setCursor(Cursor.E_RESIZE); resizers.getBottomRight().setCursor(Cursor.SE_RESIZE); resizers.getBottom().setCursor(Cursor.S_RESIZE); resizers.getBottomLeft().setCursor(Cursor.SW_RESIZE); resizers.getLeft().setCursor(Cursor.W_RESIZE); }
@Override public void handleMouse(MouseEvent event, EventType<? extends MouseEvent> type) { if (type == MouseEvent.MOUSE_ENTERED) { this.getScene().setCursor(Cursor.E_RESIZE); } else if (type == MouseEvent.MOUSE_EXITED) { if (!this.isDragging) { this.getScene().setCursor(Cursor.DEFAULT); } } else if (type == MouseEvent.MOUSE_PRESSED) { this.startMouseDrag(event.getSceneX()); } else if (type == MouseEvent.MOUSE_DRAGGED) { this.handleMouseDrag(event.getSceneX()); } else if (type == MouseEvent.MOUSE_RELEASED) { if (this.isDragging) { this.finishMouseDrag(); } } }
protected Divider armTarget(MouseEvent ev) { Divider d = getDividerUnder(ev); if(d == null) { releaseTarget(); } else { if(target == null) { double sz = targetRadius + targetRadius; target = new Region(); target.setManaged(false); target.resize(sz, sz); getChildren().add(target); } target.relocate(ev.getX() - targetRadius, ev.getY() - targetRadius); // TODO change cursor when can't move target.setCursor(horizontal ? Cursor.H_RESIZE : Cursor.V_RESIZE); } return d; }
/** * Enabling mouse drag * @param dragDelta */ private void enableMouseDrag(Delta dragDelta) { setOnMouseDragged(e -> { double newX = e.getX() + dragDelta.x; if (newX > 0 && newX < getScene().getWidth()) { setCenterX(newX); } double newY = e.getY() + dragDelta.y; if (newY > 0 && newY < getScene().getHeight()) { setCenterY(newY); } }); setOnMouseEntered(e -> { if (!e.isPrimaryButtonDown()) { getScene().setCursor(Cursor.HAND); } }); setOnMouseExited(e -> { if (!e.isPrimaryButtonDown()) { getScene().setCursor(Cursor.DEFAULT); } }); }
/** * Enables the drag feature on the points. * @param circle */ private void enableDrag(final Circle circle) { final Delta dragDelta = new Delta(); circle.setOnMousePressed(e -> { dragDelta.x = circle.getCenterX() - e.getX(); dragDelta.y = circle.getCenterY() - e.getY(); circle.getScene().setCursor(Cursor.MOVE); }); circle.setOnMouseReleased(e -> circle.getScene().setCursor(Cursor.HAND)); circle.setOnMouseDragged(e -> { circle.setCenterX(e.getX() + dragDelta.x); circle.setCenterY(e.getY() + dragDelta.y); }); enableDragCursor(circle); }
private void changeCursorToScale(Edge edge) { if (edge == Edge.NONE) { changeCursorToDefault(); return; } if (edge == Edge.TOP_LEFT || edge == Edge.BOTTOM_RIGHT) { canvas.setCursor(Cursor.NW_RESIZE); return; } if (edge == Edge.TOP_RIGHT || edge == Edge.BOTTOM_LEFT) { canvas.setCursor(Cursor.NE_RESIZE); return; } if (edge == Edge.TOP || edge == Edge.BOTTOM) { canvas.setCursor(Cursor.N_RESIZE); return; } if (edge == Edge.LEFT || edge == Edge.RIGHT) { canvas.setCursor(Cursor.W_RESIZE); return; } throw new IllegalStateException("couldn't find correct cursor for edge:" + edge.name()); }
protected void setupStyle() { this.setTextFill( ColorPalette.UI_FOREGROUND.getPaint() ); this.setBackground( this.idleStateBackground ); this.hoverProperty().addListener( ( observable, oldValue, newValue ) -> { // Hovered if ( newValue ) { this.setBackground( this.hoverStateBackground ); this.setCursor( Cursor.HAND ); return; } // Not hovered this.setBackground( this.idleStateBackground ); this.setCursor( Cursor.DEFAULT ); } ); }
private void createResizeAnchors() { resizeAnchors = new ArrayList<>(); ResizeAnchor nwResizeAnchor = new ResizeAnchor(mainController, Cursor.NW_RESIZE, focusRectangle); ResizeAnchor neResizeAnchor = new ResizeAnchor(mainController, Cursor.NE_RESIZE, focusRectangle); ResizeAnchor seResizeAnchor = new ResizeAnchor(mainController, Cursor.SE_RESIZE, focusRectangle); ResizeAnchor swResizeAnchor = new ResizeAnchor(mainController, Cursor.SW_RESIZE, focusRectangle); ResizeAnchor nResizeAnchor = new ResizeAnchor(mainController, Cursor.N_RESIZE, focusRectangle); ResizeAnchor eResizeAnchor = new ResizeAnchor(mainController, Cursor.E_RESIZE, focusRectangle); ResizeAnchor sResizeAnchor = new ResizeAnchor(mainController, Cursor.S_RESIZE, focusRectangle); ResizeAnchor wResizeAnchor = new ResizeAnchor(mainController, Cursor.W_RESIZE, focusRectangle); resizeAnchors.add(nwResizeAnchor); resizeAnchors.add(neResizeAnchor); resizeAnchors.add(seResizeAnchor); resizeAnchors.add(swResizeAnchor); resizeAnchors.add(nResizeAnchor); resizeAnchors.add(eResizeAnchor); resizeAnchors.add(sResizeAnchor); resizeAnchors.add(wResizeAnchor); }
public RotateAnchor(MainController mainController, Rectangle focusRectangle) { super(); this.mainController = mainController; setRadiusX(Data.RESIZE_ANCHOR_DIMENSION / 2); setRadiusY(Data.RESIZE_ANCHOR_DIMENSION / 2); setFill(Data.FOCUS_OUTLINE_COLOR); setCursor(Cursor.cursor(ClassLoader.getSystemResource("cur/rotate.png").toExternalForm())); MouseEventHandler rotateEventHandler = new RotateEventHandler(this.mainController); setOnMousePressed(rotateEventHandler.getMousePressedEventHandler()); setOnMouseDragged(rotateEventHandler.getMouseDraggedEventHandler()); setOnMouseReleased(rotateEventHandler.getMouseReleasedEventHandler()); centerXProperty().bind(focusRectangle.xProperty().add(focusRectangle.widthProperty().divide(2))); centerYProperty().bind(focusRectangle.yProperty().add(focusRectangle.heightProperty().divide(2))); // Apply rotation to rotate anchor getTransforms().addAll(focusRectangle.getTransforms()); }
@SuppressWarnings("unchecked") SimpleTablePairWindow(String columnName1, String columnName2, double weight) { TableColumn<Data, String> col1 = new TableColumn<>(columnName1); col1.setCellValueFactory(new PropertyValueFactory<>("col1")); TableColumn<Data, String> col2 = new TableColumn<>(columnName2); col2.setCellValueFactory(new PropertyValueFactory<>("col2")); table.getColumns().addAll(col1, col2); table.setEditable(false); table.setCursor(Cursor.DEFAULT); table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); searchBox = new SearchBox<Data>(table); VBox vbox = new VBox(); VBox.setVgrow(table, Priority.ALWAYS); vbox.getChildren().addAll(searchBox, table); getContentPane().getChildren().addAll(vbox); // Autoresize columns table.widthProperty().addListener((o, old, newValue) -> { col1.setPrefWidth(weight * table.getWidth()); col2.setPrefWidth((1 - weight) * table.getWidth()); }); }
public Labels() { // Jump to the label on click table.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> { Label label = table.getSelectionModel().getSelectedItem(); if (label != null) { Editor editor = Editor.getEditor(); if (editor != null) { Platform.runLater(() -> { editor.gotoLine(label.getLine() - 1); editor.findNext(label.label); // Now highlight the label }); } } }); // Fix table cursor table.setCursor(Cursor.DEFAULT); programTextPolling = Executors.newSingleThreadScheduledExecutor( new ThreadUtils.NamedThreadFactory("Labels-Polling")); programTextPolling.scheduleAtFixedRate(this::refreshData, 0, 1, TimeUnit.SECONDS); }
private AssemblingDialog(WindowManager wm) { super(AlertType.INFORMATION); initOwner(wm.getPrimaryStage()); UIUtils.setDialogBoxIcon(this); this.wm = wm; setTitle("Assembling"); setHeaderText("Assembling"); setContentText(contentText); Platform.runLater(() -> { show(); getDialogPane().setCursor(Cursor.WAIT); }); wm.getCPU().registerListener(new AssemblingFinishedListener()); executor = Executors.newSingleThreadScheduledExecutor(new ThreadUtils.NamedThreadFactory("Assembling-Dialog")); updateTask = executor.scheduleAtFixedRate(() -> Platform.runLater(() -> setContentText(getNext(getContentText()))), 0, 500, TimeUnit.MILLISECONDS); }
/** * Close down the dialog and return focus to the editor */ private void closeDown() { updateTask.cancel(true); executor.shutdownNow(); Platform.runLater(() -> { close(); // to fix an annoyance with focus not returning properly and // when it does, having the wrong cursor wm.getPrimaryStage().requestFocus(); Editor e = (Editor) wm.getWorkspace().findInternalWindow(WindowEnum.EDITOR); if (e != null) { e.requestFocus(); e.setCursor(Cursor.DEFAULT); } }); }
/** Utility function to set the style of a main menu option button */ private void styleOptionButton( Button button, double width, int index, Stage stage ){ if(button.getText().length() > 5){ button.setFont( Font.loadFont( getClass().getResourceAsStream("resources/Indieflower.ttf"), width/5 )); }else{ button.setFont( Font.loadFont( getClass().getResourceAsStream("resources/Indieflower.ttf"), width/4 )); } button.setEllipsisString(""); //the rest is all for a 'hover-over' background image and cursor change button.setBackground( new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)) ); button.setOnMouseEntered(e -> { Platform.runLater(() -> stage.getScene().setCursor( Cursor.HAND )); optionsBackground.setViewport(new Rectangle2D(0, (spriteHeight/10)*(index), spriteWidth, spriteHeight/10)); }); button.setOnMouseExited(e -> { Platform.runLater(() -> stage.getScene().setCursor(Cursor.DEFAULT)); optionsBackground.setViewport(new Rectangle2D(0, 0, spriteWidth, spriteHeight/10)); }); }
private static Label createHyperlinkLabel(String uri, String str, Scene scene) { Label result = new Label(str); result.setUnderline(true); result.setTextFill(Color.web("#0026ff")); result.setOnMouseClicked(e -> SwingUtilities.invokeLater(() -> { // call on EDT if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(new URI(uri)); } catch (IOException | URISyntaxException ex) { ex.printStackTrace(); } } })); result.setOnMouseEntered(e -> scene.setCursor(Cursor.HAND)); result.setOnMouseExited(e -> scene.setCursor(Cursor.DEFAULT)); return result; }
HoverNode(BigDecimal priorValue, BigDecimal value) { setPrefSize(6, 6); final Label label = createDataThresholdLabel(priorValue, value); setOnMouseEntered(e -> { getChildren().setAll(label); setCursor(Cursor.DEFAULT); toFront(); }); setOnMouseExited(e -> { getChildren().clear(); setCursor(Cursor.DEFAULT); }); }
private void setUpDraggingHorizontalHandle(Rectangle rectangle, Wrapper<Point2D> mouseLocation) { rectangle.setOnMouseEntered(event -> { rectangle.getParent().setCursor(Cursor.H_RESIZE); mouseLocation.value = new Point2D(event.getSceneX(), event.getSceneY()); }); rectangle.setOnMouseExited(event -> { if (!rectangle.isPressed()) { rectangle.getParent().setCursor(Cursor.DEFAULT); } mouseLocation.value = new Point2D(event.getSceneX(), event.getSceneY()); }); rectangle.setOnDragDetected(event -> { rectangle.getParent().setCursor(Cursor.H_RESIZE); mouseLocation.value = new Point2D(event.getSceneX(), event.getSceneY()); }); rectangle.setOnMouseReleased(event -> { rectangle.getParent().setCursor(Cursor.DEFAULT); mouseLocation.value = null; }); }
private void setUpDraggingMoveHandle(Circle circle, Wrapper<Point2D> mouseLocation) { circle.setOnMouseEntered(event -> { circle.getParent().setCursor(Cursor.MOVE); mouseLocation.value = new Point2D(event.getSceneX(), event.getSceneY()); }); circle.setOnMouseExited(event -> { if (!circle.isPressed()) { circle.getParent().setCursor(Cursor.DEFAULT); } mouseLocation.value = new Point2D(event.getSceneX(), event.getSceneY()); }); circle.setOnDragDetected(event -> { circle.getParent().setCursor(Cursor.MOVE); mouseLocation.value = new Point2D(event.getSceneX(), event.getSceneY()); }); circle.setOnMouseReleased(event -> { circle.getParent().setCursor(Cursor.DEFAULT); mouseLocation.value = null; }); }
private void setUpDraggingRotateHandle(Circle circle, Wrapper<Point2D> mouseLocation) { circle.setOnMouseEntered(event -> { circle.getParent().setCursor(Cursor.CLOSED_HAND); mouseLocation.value = new Point2D(event.getSceneX(), event.getSceneY()); }); circle.setOnMouseExited(event -> { if (!circle.isPressed()) { circle.getParent().setCursor(Cursor.DEFAULT); } mouseLocation.value = new Point2D(event.getSceneX(), event.getSceneY()); }); circle.setOnDragDetected(event -> { circle.getParent().setCursor(Cursor.CLOSED_HAND); mouseLocation.value = new Point2D(event.getSceneX(), event.getSceneY()); }); circle.setOnMouseReleased(event -> { circle.getParent().setCursor(Cursor.DEFAULT); mouseLocation.value = null; }); }
private void setUpDraggingVerticalHandle(Rectangle rectangle, Wrapper<Point2D> mouseLocation) { rectangle.setOnMouseEntered(event -> { rectangle.getParent().setCursor(Cursor.V_RESIZE); mouseLocation.value = new Point2D(event.getSceneX(), event.getSceneY()); }); rectangle.setOnMouseExited(event -> { if (!rectangle.isPressed()) { rectangle.getParent().setCursor(Cursor.DEFAULT); } mouseLocation.value = new Point2D(event.getSceneX(), event.getSceneY()); }); rectangle.setOnDragDetected(event -> { rectangle.getParent().setCursor(Cursor.V_RESIZE); mouseLocation.value = new Point2D(event.getSceneX(), event.getSceneY()); }); rectangle.setOnMouseReleased(event -> { rectangle.getParent().setCursor(Cursor.DEFAULT); mouseLocation.value = null; }); }
private void initializeExpressionListViews() { nuSwitchedExpressionsListView.setStyle(SquidUI.EXPRESSION_LIST_CSS_STYLE_SPECS); nuSwitchedExpressionsListView.setCursor(Cursor.CLOSED_HAND); nuSwitchedExpressionsListView.setCellFactory(new expressionCellFactory()); builtInExpressionsListView.setStyle(SquidUI.EXPRESSION_LIST_CSS_STYLE_SPECS); builtInExpressionsListView.setCursor(Cursor.CLOSED_HAND); builtInExpressionsListView.setCellFactory(new expressionCellFactory()); customExpressionsListView.setStyle(SquidUI.EXPRESSION_LIST_CSS_STYLE_SPECS); customExpressionsListView.setCursor(Cursor.CLOSED_HAND); customExpressionsListView.setCellFactory(new expressionCellFactory()); populateExpressionListViews(); }