當前位置: 首頁>>代碼示例>>Java>>正文


Java Cursor類代碼示例

本文整理匯總了Java中javafx.scene.Cursor的典型用法代碼示例。如果您正苦於以下問題:Java Cursor類的具體用法?Java Cursor怎麽用?Java Cursor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Cursor類屬於javafx.scene包,在下文中一共展示了Cursor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import javafx.scene.Cursor; //導入依賴的package包/類
@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();
}
 
開發者ID:GwtDomino,項目名稱:domino-todolist,代碼行數:51,代碼來源:DesktopLayoutView.java

示例2: mouseReleased

import javafx.scene.Cursor; //導入依賴的package包/類
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);
}
 
開發者ID:wpilibsuite,項目名稱:shuffleboard,代碼行數:17,代碼來源:TileDragResizer.java

示例3: addMenuItem

import javafx.scene.Cursor; //導入依賴的package包/類
@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);
}
 
開發者ID:GwtDomino,項目名稱:domino-todolist,代碼行數:12,代碼來源:DesktopLayoutView.java

示例4: setImages

import javafx.scene.Cursor; //導入依賴的package包/類
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));

        }
    }
 
開發者ID:AntonioGabrielAndrade,項目名稱:LIRE-Lab,代碼行數:19,代碼來源:CollectionGrid.java

示例5: createDocument

import javafx.scene.Cursor; //導入依賴的package包/類
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;
    }
}
 
開發者ID:victorward,項目名稱:recruitervision,代碼行數:18,代碼來源:PDFCreator.java

示例6: seriesLegendLabelCustomAction

import javafx.scene.Cursor; //導入依賴的package包/類
@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);

	});

}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:23,代碼來源:PMDViolationbyPieChartComposite.java

示例7: initializeOperationOrFunctionListViews

import javafx.scene.Cursor; //導入依賴的package包/類
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();
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:20,代碼來源:ExpressionBuilderController.java

示例8: Thumb2CodeArea

import javafx.scene.Cursor; //導入依賴的package包/類
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();
        }
    });
}
 
開發者ID:kasirgalabs,項目名稱:ETUmulator,代碼行數:21,代碼來源:Thumb2CodeArea.java

示例9: setupBox

import javafx.scene.Cursor; //導入依賴的package包/類
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);
		}
	});
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:22,代碼來源:TimelineDiffViewerRenderer.java

示例10: createIv

import javafx.scene.Cursor; //導入依賴的package包/類
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;
}
 
開發者ID:clonex10100,項目名稱:Dna-replication-game,代碼行數:24,代碼來源:PrimeZoneActivater.java

示例11: start

import javafx.scene.Cursor; //導入依賴的package包/類
/**
 *
 * @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();
}
 
開發者ID:juebanlin,項目名稱:util4j,代碼行數:46,代碼來源:Game2048.java

示例12: handleMarkAll

import javafx.scene.Cursor; //導入依賴的package包/類
/**
 * 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");
}
 
開發者ID:Alienturnedhuman,項目名稱:PearPlanner,代碼行數:25,代碼來源:MenuController.java

示例13: parseAllFiles

import javafx.scene.Cursor; //導入依賴的package包/類
@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();
}
 
開發者ID:victorward,項目名稱:recruitervision,代碼行數:18,代碼來源:ParsingServiceImpl.java

示例14: extractData

import javafx.scene.Cursor; //導入依賴的package包/類
@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();
}
 
開發者ID:victorward,項目名稱:recruitervision,代碼行數:18,代碼來源:GateServiceImpl.java

示例15: initialize

import javafx.scene.Cursor; //導入依賴的package包/類
@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");
}
 
開發者ID:Laity000,項目名稱:ChatRoom-JavaFX,代碼行數:20,代碼來源:LoginController.java


注:本文中的javafx.scene.Cursor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。