本文整理汇总了Java中javafx.scene.control.Button.setAlignment方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setAlignment方法的具体用法?Java Button.setAlignment怎么用?Java Button.setAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Button
的用法示例。
在下文中一共展示了Button.setAlignment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: DateCellSkin
import javafx.scene.control.Button; //导入方法依赖的package包/类
public DateCellSkin(final DateCell control) {
this.dateCell = control;
button = new Button();
button.textProperty().bind(control.textProperty());
button.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
button.setAlignment(Pos.CENTER);
button.setMinWidth(30);
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
control.getCalendarView().setSelectedDate(control.getItem());
}
});
button.tooltipProperty().bind(control.tooltipProperty());
getChildren().add(button);
}
示例3: ButtonControl
import javafx.scene.control.Button; //导入方法依赖的package包/类
public ButtonControl(String name) {
super(name, FlashboardSendableType.ACTIVATABLE);
node = new HBox();
node.setAlignment(Pos.CENTER);
button = new Button(name);
button.setPrefSize(WIDTH, HEIGHT);
button.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event) {
press();
button.setDisable(true);
}
});
node.getChildren().add(button);
button.setAlignment(Pos.CENTER);
}
示例4: load
import javafx.scene.control.Button; //导入方法依赖的package包/类
private void load(String fxml, String buttonName, Image background, boolean showDefault) {
Parent parent = null;
try {
parent = FXMLLoader.load(Main.class.getResource("/fxml/" + fxml + ".fxml"));
panes.put(fxml, parent);
ImageView imageView = new ImageView(background);
imageView.setFitHeight(30);
imageView.setFitWidth(30);
Button button = new Button(buttonName, imageView);
button.setAlignment(Pos.BASELINE_LEFT);
button.setPrefSize(200, 50);
button.setStyle("-fx-border-width: 0;");
InterfaceManager.addInterface(Container.create(fxml, button));
if (showDefault) FrameController.instance.pane.getChildren().add(getInstance(fxml));
} catch (IOException e) {
e.printStackTrace();
}
}
示例5: buildButton
import javafx.scene.control.Button; //导入方法依赖的package包/类
private Button buildButton() {
Button submit = new Button(localeService.getMessage("ui.menu.file.connect.submit.text"));
submit.setAlignment(Pos.CENTER);
submit.setOnAction(this::handleClick);
submit.setOnKeyPressed(event -> {
if (event.getCode() == KeyCode.ENTER) {
handleClick(event);
}
});
return submit;
}