本文整理汇总了Java中javafx.scene.text.Text.setOnMouseClicked方法的典型用法代码示例。如果您正苦于以下问题:Java Text.setOnMouseClicked方法的具体用法?Java Text.setOnMouseClicked怎么用?Java Text.setOnMouseClicked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.text.Text
的用法示例。
在下文中一共展示了Text.setOnMouseClicked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMessageBar
import javafx.scene.text.Text; //导入方法依赖的package包/类
private Node getMessageBar(VBox vbox) {
HBox hb = new HBox(10);
hb.setPrefHeight(32);
hb.setStyle("-fx-padding: 0 5px 0 5px; -fx-background-color: " + _message_bg + ";");
CheckBox cb = new CheckBox("Do Not Show Again");
cb.setStyle("-fx-text-fill: " + _message_fg + ";-fx-fill: " + _message_fg + ";");
Text b = FXUIUtils.getIconAsText("close");
b.setOnMouseClicked((e) -> {
JSONObject preferences = Preferences.instance().getSection("display");
preferences.put("_doNotShowMessage", cb.isSelected());
Preferences.instance().save("display");
vbox.getChildren().remove(0);
});
Text t = new Text(_message);
hb.setAlignment(Pos.CENTER_LEFT);
HBox.setHgrow(t, Priority.ALWAYS);
t.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold; -fx-font-family: Tahoma;");
b.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold;");
Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);
hb.getChildren().addAll(t, spacer, b);
return hb;
}
示例2: addToolBar
import javafx.scene.text.Text; //导入方法依赖的package包/类
private void addToolBar() {
TextField textField = new TextField();
textField.getStyleClass().add("search-field");
textField.textProperty().bindBidirectional(getSkinnable().filterTextProperty());
Text clearIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.TIMES_CIRCLE, "18");
CustomTextField customTextField = new CustomTextField();
customTextField.getStyleClass().add("search-field");
customTextField.setLeft(FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.SEARCH, "18px"));
customTextField.setRight(clearIcon);
customTextField.textProperty().bindBidirectional(getSkinnable().filterTextProperty());
clearIcon.setOnMouseClicked(evt -> customTextField.setText(""));
FlipPanel searchFlipPanel = new FlipPanel();
searchFlipPanel.setFlipDirection(Orientation.HORIZONTAL);
searchFlipPanel.getFront().getChildren().add(textField);
searchFlipPanel.getBack().getChildren().add(customTextField);
searchFlipPanel.visibleProperty().bind(getSkinnable().enableSortingAndFilteringProperty());
getSkinnable().useControlsFXProperty().addListener(it -> {
if (getSkinnable().isUseControlsFX()) {
searchFlipPanel.flipToBack();
} else {
searchFlipPanel.flipToFront();
}
});
showTrailerButton = new Button("Show Trailer");
showTrailerButton.getStyleClass().add("trailer-button");
showTrailerButton.setMaxHeight(Double.MAX_VALUE);
showTrailerButton.setOnAction(evt -> showTrailer());
BorderPane toolBar = new BorderPane();
toolBar.setLeft(showTrailerButton);
toolBar.setRight(searchFlipPanel);
toolBar.getStyleClass().add("movie-toolbar");
container.add(toolBar, 1, 0);
}