本文整理匯總了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();
}
示例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);
}
示例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);
}
示例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));
}
}
示例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;
}
}
示例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);
});
}
示例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();
}
示例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();
}
});
}
示例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);
}
});
}
示例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;
}
示例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();
}
示例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");
}
示例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();
}
示例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();
}
示例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");
}