本文整理汇总了Java中javafx.scene.control.Button.setId方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setId方法的具体用法?Java Button.setId怎么用?Java Button.setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Button
的用法示例。
在下文中一共展示了Button.setId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRemovableSearchOutput
import javafx.scene.control.Button; //导入方法依赖的package包/类
private SearchOutput createRemovableSearchOutput() {
SearchOutput output = new SearchOutput();
output.setId("second-output");
Button removeButton = new Button();
removeButton.setGraphic(new TangoIconWrapper("actions:list-remove"));
removeButton.setTooltip(new Tooltip("unsplit output"));
removeButton.setId("unsplit-output-button");
removeButton.setOnAction(event -> {
Node removedOutput = centerBox.getChildren().remove(centerBox.getChildren().size()-1);
outputs.remove(removedOutput);
queryGrid.removeAllListenersButFirst();
outputs.get(0).enableTitleGraphics();
});
output.addTitleGraphics(removeButton);
return output;
}
示例2: createSplittableSearchOutput
import javafx.scene.control.Button; //导入方法依赖的package包/类
private SearchOutput createSplittableSearchOutput(Collection collection, Feature feature) {
SearchOutput output = new SearchOutput();
output.setId("output");
Button splitButton = new Button();
splitButton.setGraphic(new TangoIconWrapper("actions:list-add"));
splitButton.setTooltip(new Tooltip("split output"));
splitButton.setId("split-output-button");
splitButton.setOnAction(event -> {
setupSecondOutput(collection, collection.totalFeatures() > 1 ? collection.getFeature(1) : feature);
output.disableTitleGraphics();
});
output.addTitleGraphics(splitButton);
return output;
}
示例3: display
import javafx.scene.control.Button; //导入方法依赖的package包/类
public static void display(String title, String message)
{
Stage window= new Stage();
window.initModality(Modality.APPLICATION_MODAL);
//window.setAlwaysOnTop(true);
window.getIcons().add(new Image("/pic/slogo.png"));
window.setTitle(title);
Label label= new Label();
label.setText(message);
label.setStyle("-fx-font-size:14px;");
ImageView imageView = new ImageView(ICON);
imageView.setFitWidth(40);
imageView.setFitHeight(40);
Label labelimage = new Label("",imageView);
// two buttons
Button okbtn= new Button("Ok");
okbtn.setOnAction(e -> {
answer= false;
window.close();
});
okbtn.setId("red");
HBox hbox= new HBox(10);
hbox.setAlignment(Pos.CENTER_LEFT);
hbox.setPadding(new Insets(10,5,10,5));
hbox.getChildren().addAll(labelimage,label);
VBox layout= new VBox(15);
layout.setAlignment(Pos.CENTER_RIGHT);
layout.setPadding(new Insets(10,5,10,5));
layout.getChildren().addAll(hbox,okbtn);
layout.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672);");
Scene scene= new Scene(layout);
scene.getStylesheets().add(ErrorMessage.class.getResource("confirm.css").toExternalForm());
window.setScene(scene);
window.setResizable(false);
window.showAndWait();
}
示例4: display
import javafx.scene.control.Button; //导入方法依赖的package包/类
public static void display(String title, String message)
{
Stage window= new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.setAlwaysOnTop(true);
window.getIcons().add(new Image("/pic/slogo.png"));
window.setTitle(title);
Label label= new Label();
label.setText(message);
label.setStyle("-fx-font-size:14px;");
ImageView imageView = new ImageView(ICON);
imageView.setFitWidth(40);
imageView.setFitHeight(40);
Label labelimage = new Label("",imageView);
// two buttons
Button okbtn= new Button("Ok");
okbtn.setOnAction(e -> {
answer= false;
window.close();
});
okbtn.setId("blue");
HBox hbox= new HBox(10);
hbox.setAlignment(Pos.CENTER_LEFT);
hbox.setPadding(new Insets(10,5,10,5));
hbox.getChildren().addAll(labelimage,label);
VBox layout= new VBox(15);
layout.setAlignment(Pos.CENTER_RIGHT);
layout.setPadding(new Insets(10,5,10,5));
layout.getChildren().addAll(hbox,okbtn);
layout.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672);");
Scene scene= new Scene(layout);
window.setScene(scene);
scene.getStylesheets().add(SuccessMessage.class.getResource("confirm.css").toExternalForm());
window.setResizable(false);
window.showAndWait();
}
示例5: createButton
import javafx.scene.control.Button; //导入方法依赖的package包/类
private Button createButton() {
Button starting = new Button("Start A Game of Random Level");
starting.setLayoutX(500);
starting.setLayoutY(600);
starting.setId("starting");
starting.setMinWidth(100);
starting.setMinHeight(100);
return starting;
}
示例6: refreshView
import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
public void refreshView ()
{
renameLayout.getChildren().clear();
doorname="";
if(getFXController().getLastViewName().matches("views.StackView.*"))
{
doorname = getMyModel().getDataList("").get(getMyModel().getDataList("").size()-1);
}
oldValue = getMyModel().getString("");
TextField front = new TextField(getMyModel().getString(""));
front.setPromptText("Eingabe erforderlich");
Button saveBtn = new Button("Speichern"); // \u270d \u2055 \u2699 \u270E
saveBtn.setId("small");
saveBtn.setOnAction(e ->
{
saveNameAndExit(oldValue, front.getText(), doorname);
});
saveBtn.setOnKeyReleased(e ->
{
if (e.getCode() == KeyCode.ENTER)
saveNameAndExit(oldValue, front.getText(), doorname);
});
front.setOnKeyReleased(e ->
{
if (e.getCode() == KeyCode.ENTER)
{
saveNameAndExit(oldValue, front.getText(), doorname);
}
});
renameLayout.getChildren().addAll(front, saveBtn);
scroller.setContent(renameLayout);
}
示例7: createLogin
import javafx.scene.control.Button; //导入方法依赖的package包/类
private Node createLogin () {
HBox box = new HBox(Integer.parseInt(mySpecs.getString(SPACING_KEY)));
box.setAlignment(Pos.CENTER);
Button fbButton =
createButton(myLabels.getString("splashloginfb"), e -> loginWithFacebook());
fbButton.setId(mySpecs.getString("fbbutton"));
box.getChildren()
.add(fbButton);
return box;
}
示例8: updateButton
import javafx.scene.control.Button; //导入方法依赖的package包/类
private Node updateButton() {
Button button = factory.createButton(commandProperty.getValue(), () -> comboBox.getValue());
button.setId("toolbar-search-collection");
setupButtonDisableProperty(button);
return getChildren().set(1, button);
}
示例9: initLeftToolBar
import javafx.scene.control.Button; //导入方法依赖的package包/类
private void initLeftToolBar() {
leftToolBar.getChildren().clear();
List<Command<Void>> leftToolBarCommands = applicationCommands.getLeftToolBarCommands();
for (Command<Void> command : leftToolBarCommands) {
Button button = commandTriggerFactory.createButton(command, () -> null);
button.setId("toolbar-" + command.getNodeId());
leftToolBar.getChildren().add(button);
}
}
示例10: initRightTooBar
import javafx.scene.control.Button; //导入方法依赖的package包/类
private void initRightTooBar() {
rightToolBar.getChildren().clear();
List<Command<Void>> commands = applicationCommands.getRightToolBarCommands();
for (Command<Void> command : commands) {
Button button = commandTriggerFactory.createButton(command, () -> null);
button.setId("toolbar-" + command.getNodeId());
rightToolBar.getChildren().add(button);
}
rightToolBar.getChildren().add(searchCollectionComboBox);
}
示例11: setupToolBar
import javafx.scene.control.Button; //导入方法依赖的package包/类
private void setupToolBar(Collection collection, List<Command<Collection>> commands) {
for (Command<Collection> command : commands) {
Button button = commandTriggerFactory.createButton(command, () -> collection);
button.setId("collection-detail-" + command.getNodeId());
topLine.getChildren().add(button);
}
}
示例12: FeaturesPane
import javafx.scene.control.Button; //导入方法依赖的package包/类
public FeaturesPane() {
super();
getStylesheets().add(FeaturesPane.class.getResource("/options-pane.css").toExternalForm());
getStyleClass().add("options-pane");
Button all = new Button("All");
all.setOnAction(evt -> features.forEach(f -> f.setActive(true)));
all.setMaxWidth(Double.MAX_VALUE);
all.setId("all-button");
Util.installWindowDragListener(all);
Button reset = new Button("Reset");
reset.setOnAction(evt -> features.forEach(f -> f.setActive(false)));
reset.setMaxWidth(Double.MAX_VALUE);
reset.setId("reset-button");
Util.installWindowDragListener(reset);
HBox top = new HBox(all, reset);
top.getStyleClass().add("toolbar");
top.setFillHeight(true);
HBox.setHgrow(all, Priority.ALWAYS);
HBox.setHgrow(reset, Priority.ALWAYS);
getChildren().add(top);
}
示例13: createButton
import javafx.scene.control.Button; //导入方法依赖的package包/类
private Button createButton(Pane root, ColorPicker colorPicker) {
Button okayButton = new Button(myResources.getString("OkayButton"));
okayButton.setLayoutX(200);
okayButton.setLayoutY(100);
okayButton.setId("btnLogin");
okayButton.setOnAction(e -> {
root.setBackground(new Background(new BackgroundFill(colorPicker.getValue(), CornerRadii.EMPTY, Insets.EMPTY)));
stage.close();
});
return okayButton;
}
示例14: display
import javafx.scene.control.Button; //导入方法依赖的package包/类
public static boolean display(String title, String message)
{
Stage window= new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.getIcons().add(new Image("/pic/slogo.png"));
window.setTitle(title);
Label label= new Label();
label.setText(message);
label.setStyle("-fx-font-size:14px;");
ImageView imageView = new ImageView(ICON);
imageView.setFitWidth(50);
imageView.setFitHeight(50);
Label labelimage = new Label("",imageView);
// two buttons
Button yesbtn= new Button("Yes");
yesbtn.setId("red");
Button nobtn= new Button("No");
nobtn.setId("blue");
Button ynbtn= new Button("Backup");
ynbtn.setId("green");
yesbtn.setOnAction(e -> {
answer= true;
SuccessMessage.display("Success", "Your tables have been cleared");
window.close();
});
nobtn.setOnAction(e -> {
answer= false;
window.close();
});
ynbtn.setOnAction(e -> {
try {
window.close();
new Back().start(new Stage());
} catch (Exception e1) {
ErrorMessage.display("Launch Error", e1.getMessage()+" /nError occured during launching application");
e1.printStackTrace();
}
});
HBox hbox= new HBox(10);
hbox.setAlignment(Pos.CENTER_RIGHT);
hbox.setPadding(new Insets(0,5,0,5));
hbox.getChildren().addAll(yesbtn, ynbtn ,nobtn);
HBox layout= new HBox(5);
layout.setPadding(new Insets(10,5,10,5));
layout.getChildren().addAll(labelimage,label);
VBox layout2= new VBox(10);
layout2.setPadding(new Insets(10,5,10,5));
layout2.getChildren().addAll(layout, hbox);
layout2.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672);");
Scene scene= new Scene(layout2);
window.setScene(scene);
window.setResizable(false);
scene.getStylesheets().add(ComplexConfirm.class.getResource("confirm.css").toExternalForm());
window.showAndWait();
return answer;
}
示例15: display
import javafx.scene.control.Button; //导入方法依赖的package包/类
public static boolean display(String title, String message)
{
Stage window= new Stage();
window.initModality(Modality.APPLICATION_MODAL);
window.getIcons().add(new Image("/pic/slogo.png"));
window.setTitle(title);
//window.setAlwaysOnTop(true);
Label label= new Label();
label.setText(message);
label.setStyle("-fx-font-size:14px;");
label.setAlignment(Pos.CENTER_LEFT);
ImageView imageView = new ImageView(ICON);
imageView.setFitWidth(35);
imageView.setFitHeight(35);
Label labelimage = new Label("",imageView);
// two buttons
Button yesbtn= new Button("Yes");
yesbtn.setId("red");
Button nobtn= new Button("No");
nobtn.setId("green");
yesbtn.setOnAction(e -> {
answer= true;
window.close();
});
nobtn.setOnAction(e -> {
answer= false;
window.close();
});
HBox hbox= new HBox(10);
hbox.setAlignment(Pos.CENTER_RIGHT);
hbox.setPadding(new Insets(0,5,0,5));
hbox.getChildren().addAll(yesbtn, nobtn);
HBox layout= new HBox(5);
layout.setPadding(new Insets(10,5,10,5));
layout.getChildren().addAll(labelimage,label);
VBox layout2= new VBox(10);
layout2.setPadding(new Insets(10,10,10,10));
layout2.getChildren().addAll(layout, hbox);
layout2.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672);");
Scene scene= new Scene(layout2);
scene.getStylesheets().add(Confirmation.class.getResource("confirm.css").toExternalForm());
window.setScene(scene);
window.setResizable(false);
window.showAndWait();
return answer;
}