本文整理汇总了Java中javafx.scene.control.Button.setPadding方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setPadding方法的具体用法?Java Button.setPadding怎么用?Java Button.setPadding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Button
的用法示例。
在下文中一共展示了Button.setPadding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createButton
import javafx.scene.control.Button; //导入方法依赖的package包/类
public static Button createButton(String text, Node graphic, String style, Insets insets)
{
Button button = createButton(text);
button.setGraphic(graphic);
button.setStyle(style);
button.setPadding(insets);
return button;
}
示例2: addIntegrationButtonsToVbox
import javafx.scene.control.Button; //导入方法依赖的package包/类
private void addIntegrationButtonsToVbox(Integration integration, VBox vbox)
{
for (String buttonKey : integration.getActions().keySet())
{
System.out.println("*" + buttonKey);
final Action clickableButton = integration.getActions().get(buttonKey);
if (clickableButton.isHiddenFromFrontend())
{
continue;
}
final Button jfxButton = new Button(clickableButton.getName());
jfxButton.setPadding(new Insets(2, 4, 2, 4));
jfxButton.setMinWidth(256);
jfxButton.setMaxWidth(256);
jfxButton.setAlignment(Pos.BASELINE_LEFT);
jfxButton.setContentDisplay(ContentDisplay.RIGHT);
jfxButton.setTooltip(new Tooltip(buttonKey + "\n" + clickableButton.getDescription())); // I tried it, but it looks a bit janky
jfxButton.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent arg0)
{
try
{
triggerEvent("<" + clickableButton.getName() + "> from frontend", null);
clickableButton.onAction(null);
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
vbox.getChildren().add(jfxButton);
}
}
示例3: setRightBlock
import javafx.scene.control.Button; //导入方法依赖的package包/类
public VBox setRightBlock(){
VBox jobb = new VBox(10);
jobb.setSpacing(10);
jobb.setPrefWidth(200);
jobb.setPrefHeight(500);
jobb.setLayoutX(WIDTH-200);
Button gomb = new Button("Játék újrakezdése");
gomb.setPrefWidth(150);
gomb.setPadding(new Insets(10, 10, 10, 10));
gomb.setTranslateX((jobb.getPrefWidth()-gomb.getPrefWidth())/2);
gomb.setTranslateY(50);
jobb.setStyle("-fx-background-color: #c2c2d6;");
jobb.getChildren().add(gomb);
Text manualTitle = new Text("Irányítás:");
manualTitle.setTranslateX(50);
manualTitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
manualTitle.setTranslateY(100);
jobb.getChildren().add(manualTitle);
GridPane moveHolder = new GridPane();
moveHolder.setAlignment(Pos.CENTER);
moveHolder.setHgap(10);
moveHolder.setVgap(10);
moveHolder.setPrefWidth(200);
moveHolder.setPrefHeight(400);
Text moveUp = new Text("↑ - Felfele lépés");
moveUp.setTextAlignment(TextAlignment.CENTER);
moveUp.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
moveHolder.add(moveUp, 0, 0, 2, 1);
Text moveDown = new Text("↓ - Lefele lépés");
moveDown.setTextAlignment(TextAlignment.CENTER);
moveDown.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
moveHolder.add(moveDown, 0, 1, 2, 1);
Text moveLeft = new Text("← - Balra lépés");
moveLeft.setTextAlignment(TextAlignment.CENTER);
moveLeft.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
moveHolder.add(moveLeft, 0, 2, 2, 1);
Text moveRight = new Text("→ - Jobbra lépés");
moveRight.setTextAlignment(TextAlignment.CENTER);
moveRight.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
moveHolder.add(moveRight, 0, 3, 2, 1);
jobb.getChildren().add(moveHolder);
gomb.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
playGround.lepes = 0;
playGround.celban = 0;
playGround.getDatum();
playGround.resetPlayGround();
updatePlayGround();
playGround.nyertes = 0;
playGround.kezdes = 1;
}
});
return jobb;
}