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