当前位置: 首页>>代码示例>>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;未经允许,请勿转载。