本文整理汇总了Java中javafx.scene.control.ButtonBuilder类的典型用法代码示例。如果您正苦于以下问题:Java ButtonBuilder类的具体用法?Java ButtonBuilder怎么用?Java ButtonBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ButtonBuilder类属于javafx.scene.control包,在下文中一共展示了ButtonBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRightPane
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
private Parent createRightPane() {
HBox hbox = new HBox(10);
VBox lbox = new VBox(10);
lbox.getChildren().addAll(targetControlPane, new Separator(), new Text("Target control type:"),
createControlCombo(targetControlPane, false), new Text("Target transfer modes:"), createTMSelect(targetModes));
VBox rbox = new VBox(10);
rbox.getChildren().addAll(new Text("Data formats:"), createFormatSelect(targetFormats),
ButtonBuilder.create().text("paste from clipboard").id(ID_FROM_CLIPBOARD_BUTTON).onAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
getDataFromClipboard(Clipboard.getSystemClipboard());
}
}).build());
VBox content = new VBox(10);
content.getChildren().addAll(new Text("Transfered content:"), transferedContentPane);
hbox.getChildren().addAll(lbox, new Separator(Orientation.VERTICAL), rbox,
new Separator(Orientation.VERTICAL), content);
if (parameters.size() > 0) {
hbox.setStyle("-fx-background-color: " + parameters.get(0) + ";");
}
return hbox;
}
示例2: addControlSpecificButtons
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
@Override
public void addControlSpecificButtons(Pane pane) {
Button button = ButtonBuilder.create().id(ADD_TEXT_BUTTON_ID).text("Add much text").build();
button.setOnAction(new EventHandler() {
public void handle(Event t) {
for (int i = 0; i < 1000; i++) {
TextArea ta = (TextArea) testedTextInput;
ta.setText(ta.getText() + " some text");
if (i % 10 == 0) {
ta.setText(ta.getText() + "\n");
}
}
}
});
pane.getChildren().add(button);
}
示例3: getPageSlot
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
private PageWithSlots getPageSlot(Pages page) {
PageWithSlots pageWithSlot = new PageWithSlots(page.name(), WIDTH, HEIGHT);
Pane slot = new Pane();
slot.setPrefSize(200, 200);
if (page == Pages.IPHONE_TOOLBAR) {
slot.getChildren().add(ToolBarBuilder.create()
.id(page.name().toLowerCase())
.items(
ButtonBuilder.create().text("iPhone").id("iphone").build())
.build());
} else {
slot.getChildren().add(ButtonBuilder.create()
.text("Button")
.id(page.name().toLowerCase())
.minWidth(100)
.build());
}
pageWithSlot.add(new TestNodeLeaf(page.name(), slot));
return pageWithSlot;
}
示例4: InsetTextButtonSample
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
public InsetTextButtonSample() {
String insetTextCss = InsetTextButtonSample.class.getResource("InsetTextButton.css").toExternalForm();
VBox vbox = VBoxBuilder.create().id("insettextvbox").spacing(10).padding(new Insets(10)).children(
ButtonBuilder.create().text("Inset Text Button").id("button1").build(),
ButtonBuilder.create().text("Plain Text Button").id("button2").build()).build();
vbox.getStylesheets().add(insetTextCss);
getChildren().add(vbox);
}
示例5: showHelpContent
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
/**
* Help content of XpanderFX
*/
@SuppressWarnings("deprecation")
private void showHelpContent() {
try {
Node content = FXMLLoader.load(getClass().getResource("/com/shekkar/xpanderfx/top/popup/HelpFXML.fxml"));
help_box = new VBox();
help_box.getChildren().addAll(content,
HBoxBuilder.create().alignment(Pos.CENTER_LEFT)
.padding(new Insets(0,3,0,0))
.children(
VBoxBuilder.create().minWidth(720).alignment(Pos.CENTER_LEFT).padding(new Insets(0,0,0,10))
.children(
HyperlinkBuilder.create().text("open-source on GitHub [ShekkarRaee/XpanderFX]")
.onAction(e -> this.browse("https://github.com/ShekkarRaee/XpanderFX-2048-Game-JavaFX")).build(),
LabelBuilder.create().text("[email protected]").build()
)
.build(),
ButtonBuilder.create().text("OK")
.minHeight(40)
.minWidth(70)
.style("-fx-base:black;"
+ "-fx-border-radius: 7;"
+ "-fx-background-radius: 7;")
.onAction(e -> this.popupCloser(help, help_box))
.font(Font.font("System", FontWeight.MEDIUM, FontPosture.REGULAR, 20))
.build()
).style("-fx-background-color:white")
.build()
);
help_box.setStyle("-fx-background-color: linear-gradient(lightgrey, white, lightgrey);"
+ "-fx-border-color: white;"
+ "-fx-border-width: 1;");
help.getContent().add(help_box);
} catch (IOException ex) {
Logger.getLogger(MainFXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
}
help.show(this.ICON.getScene().getWindow(), this.getNodeMaxX() + 20, this.getNodeMaxY() + 40);
this.popupOpener(help_box);
}
示例6: showAboutContent
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
/**
* About content
*/
@SuppressWarnings("deprecation")
private void showAboutContent() {
try {
Node content = FXMLLoader.load(getClass().getResource("/com/shekkar/xpanderfx/top/popup/AboutFXMLDocument.fxml"));
about_box = new VBox();
about_box.getChildren().addAll(content,
HBoxBuilder.create().alignment(Pos.CENTER_RIGHT)
.padding(new Insets(0,3,0,0))
.children(
ButtonBuilder.create().text("OK")
.minHeight(40)
.minWidth(70)
.style("-fx-base:black;"
+ "-fx-border-radius: 7;"
+ "-fx-background-radius: 7;")
.onAction(e -> this.popupCloser(about, about_box))
.font(Font.font("System", FontWeight.MEDIUM, FontPosture.REGULAR, 20))
.build()
)
.build()
);
about_box.setStyle("-fx-background-color: linear-gradient(black, lightgrey);"
+ "-fx-background-radius: 7;"
+ "-fx-border-radius: 7;");
about.getContent().add(about_box);
} catch (IOException ex) {
Logger.getLogger(MainFXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
}
about.show(this.ICON.getScene().getWindow(), this.getNodeMaxX() - 14, this.getNodeMaxY() + 12);
this.popupOpener(about_box);
}
示例7: getRestartButton
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
/**
*
* @param controller
* @return restart-button
*/
public Button getRestartButton(MainFXMLDocumentController controller) {
@SuppressWarnings("deprecation")
Button restart = ButtonBuilder.create().text("Restart")
.minWidth(50).minHeight(24)
.font(Font.font("System", FontWeight.SEMI_BOLD, FontPosture.REGULAR, 20))
.style("-fx-base:darkslategrey;"
+ "-fx-background-radius:7;"
+ "-fx-border-radius:7;")
.onAction(e -> {
controller.restart();
pp.hide();
})
.build();
return restart;
}
示例8: getQuitButton
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
/**
*
* @param controller
* @return exit-button
*/
public Button getQuitButton(MainFXMLDocumentController controller) {
@SuppressWarnings("deprecation")
Button quit = ButtonBuilder.create().text("Exit")
.minWidth(50).minHeight(24)
.font(Font.font("System", FontWeight.SEMI_BOLD, FontPosture.REGULAR, 20))
.style("-fx-base:darkslategrey;"
+ "-fx-background-radius:7;"
+ "-fx-border-radius:7;")
.onAction(e -> Platform.exit())
.build();
return quit;
}
示例9: getBody
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
/**
*
* @return root-node
*/
@SuppressWarnings("deprecation")
private BorderPane getBody() {
return BorderPaneBuilder.create().minHeight(200).minWidth(440).center(
VBoxBuilder.create().alignment(Pos.CENTER).children(
LabelBuilder.create()
.minHeight(10).build(),
LabelBuilder.create().text("Congratulation !! You won the game.")
.font(Font.font("", FontWeight.BOLD, FontPosture.ITALIC, 20))
.textFill(Color.WHITE).build(),
LabelBuilder.create()
.minHeight(30).build(),
HBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(
ButtonBuilder.create().text("Continue").font(Font.font("", FontWeight.SEMI_BOLD, FontPosture.REGULAR, 18))
.minWidth(140).textFill(Color.WHITE).style("-fx-base:darkslategrey")
.onAction(e -> this.close()).build(),
ButtonBuilder.create().text("Try Again").font(Font.font("", FontWeight.SEMI_BOLD, FontPosture.REGULAR, 18))
.minWidth(140).textFill(Color.WHITE).style("-fx-base:darkslategrey")
.onAction(e -> {
controller.restart();
this.close();
}).build()
).build()
)
.build()
).style("-fx-background-color: linear-gradient(#000000cc, darkslategrey); -fx-background-radius: 15; -fx-border-radius:15;"
+ "-fx-border-width:1; -fx-border-color:lightgrey").build();
}
示例10: CustomPopUp
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
public CustomPopUp(StackPane parentWindow) {
super();
this.parent = parentWindow;
setMaxHeight(200);
setMaxWidth(200);
getChildren().add(
StackPaneBuilder.create().style(style).minHeight(200).minWidth(200).alignment(Pos.TOP_RIGHT)
.children(ButtonBuilder.create().text("Close").onAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent paramT) {
parent.getChildren().remove(CustomPopUp.this);
}
}).build(), TextFieldBuilder.create().translateY(20).build()).build());
}
示例11: CustomPopUp
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
public CustomPopUp() {
super();
getContent().add(
StackPaneBuilder.create().style(style).minHeight(200).minWidth(200).alignment(Pos.TOP_RIGHT)
.children(ButtonBuilder.create().text("Close").onAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent paramT) {
CustomPopUp.this.hide();
}
}).build(), TextFieldBuilder.create().translateY(20).build()).build());
}
示例12: start
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
this.stage = stage;
configureScene();
configureStage();
// Logic starts
VBox vb = new VBox();
vb.setSpacing(10);
final VBox layout = VBoxBuilder.create().build();
layout.getChildren().add(new DynamicTextArea());
Button btn = ButtonBuilder.create().text("Add").onAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
layout.getChildren().add(new DynamicTextArea());
}
}).build();
final GridPane gridPane = GridPaneBuilder.create()
.styleClass("contact-details-gridpane")
// [ARE] Further modification for CAEMR-2098. Setting minimum width to show labels even if application width is changed.
.columnConstraints(ColumnConstraintsBuilder.create().hgrow(Priority.NEVER).minWidth(80).build(),
ColumnConstraintsBuilder.create().hgrow(Priority.ALWAYS).build(),
ColumnConstraintsBuilder.create().hgrow(Priority.NEVER).minWidth(100).build()).build();
gridPane.addRow(0, new Label("hi"), layout, btn);
root.getChildren().add(ScrollPaneBuilder.create().styleClass("contact-details-pane").hbarPolicy(ScrollBarPolicy.NEVER)
.fitToWidth(true).content(gridPane).build());
}
示例13: createUI
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
/**
* create the UI on first call
*
* @return
*/
private Node createUI() {
final AnchorPane anchor = AnchorPaneBuilder.create()
.styleClass("roundedAnchorPaneFX").build();
final Label heading = LabelBuilder.create()
.text(this.getResourceBundle().getString("javafxCompTop"))
.alignment(Pos.CENTER).styleClass("propLabel").build();
final Button top = ButtonBuilder.create()
.text(this.getResourceBundle().getString("send")).layoutX(120)
.onMouseClicked(this.getEventHandler()).alignment(Pos.CENTER)
.build();
this.textField = TextFieldBuilder.create().text("")
.styleClass("propTextField").alignment(Pos.CENTER).build();
AnchorPane.setBottomAnchor(top, 25.0);
AnchorPane.setRightAnchor(top, 25.0);
AnchorPane.setRightAnchor(heading, 50.0);
AnchorPane.setTopAnchor(heading, 10.0);
AnchorPane.setTopAnchor(this.textField, 50.0);
AnchorPane.setRightAnchor(this.textField, 25.0);
anchor.getChildren().addAll(heading, top, this.textField);
GridPane.setHgrow(anchor, Priority.ALWAYS);
GridPane.setVgrow(anchor, Priority.ALWAYS);
return anchor;
}
示例14: createUI
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
/**
* create the UI on first call
*
* @return
*/
private Node createUI() {
final AnchorPane anchor = AnchorPaneBuilder.create()
.styleClass("roundedAnchorPaneFX").build();
final Label heading = LabelBuilder.create()
.text(this.getResourceBundle().getString("javafxComp"))
.alignment(Pos.CENTER_RIGHT).styleClass("propLabelBig").build();
final Button left = ButtonBuilder
.create()
.text(this.getResourceBundle().getString("send"))
.layoutX(120)
.onMouseClicked(
this.getActionListener("id01.id003",
"hello stateful component").getListener())
.alignment(Pos.CENTER).build();
this.textField = TextFieldBuilder.create().text("")
.styleClass("propTextField").alignment(Pos.CENTER).build();
AnchorPane.setRightAnchor(heading, 25.0);
AnchorPane.setTopAnchor(heading, 15.0);
AnchorPane.setTopAnchor(left, 80.0);
AnchorPane.setRightAnchor(left, 25.0);
AnchorPane.setTopAnchor(this.textField, 50.0);
AnchorPane.setRightAnchor(this.textField, 25.0);
AnchorPane.setLeftAnchor(this.textField, 25.0);
anchor.getChildren().addAll(heading, left, this.textField);
GridPane.setHgrow(anchor, Priority.ALWAYS);
GridPane.setVgrow(anchor, Priority.ALWAYS);
return anchor;
}
示例15: buildStartGamePanel
import javafx.scene.control.ButtonBuilder; //导入依赖的package包/类
/**
* Builds the start game panel.
*
* @return the node
*/
private Node buildStartGamePanel() {
final FlowPane fp = new FlowPane();
this.playButton = ButtonBuilder.create().id("playButton")
.styleClass("play")
.minHeight(130)
.minWidth(180)
// .text("Start Game")
.build();
fp.getChildren().add(this.playButton);
fp.setAlignment(Pos.TOP_CENTER);
return fp;
}