本文整理汇总了Java中javafx.scene.control.Button.setMinWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setMinWidth方法的具体用法?Java Button.setMinWidth怎么用?Java Button.setMinWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Button
的用法示例。
在下文中一共展示了Button.setMinWidth方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMenuItem
import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
public void addMenuItem(LayoutContext.LayoutMenuItem layoutMenuItem) {
Image image = new Image(getClass().getResourceAsStream("/" + layoutMenuItem.icon() + ".png"));
Button item = new Button("", new ImageView(image));
item.setTooltip(new Tooltip(layoutMenuItem.text()));
item.setCursor(Cursor.HAND);
item.setBackground(Background.EMPTY);
item.setMinWidth(menu.getMinWidth());
item.setOnAction(event -> layoutMenuItem.selectHandler().onSelect());
menu.getChildren().add(item);
}
示例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: 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);
}
示例4: createButtonMinW
import javafx.scene.control.Button; //导入方法依赖的package包/类
public static Button createButtonMinW(String text, double width)
{
Button button = createButton();
button.setText(text);
button.setMinWidth(width);
return button;
}
示例5: createControlPane
import javafx.scene.control.Button; //导入方法依赖的package包/类
private HBox createControlPane()
{
HBox hbox = new HBox();
setAlignment(hbox, Pos.CENTER);
hbox.setAlignment(Pos.CENTER_LEFT);
hbox.setPadding(new Insets(10, 10, 10, 10));
hbox.setSpacing(5);
Label label = new Label("Send");
label.setMinWidth(Label.USE_PREF_SIZE);
hbox.getChildren().add(label);
ComboBox<String> dropdown = createDisplayOptionsDropdown();
dropdown.setMinWidth(ComboBox.USE_PREF_SIZE);
hbox.getChildren().add(dropdown);
TextField valueField = new TextField();
valueField.setPrefWidth(Integer.MAX_VALUE);
hbox.getChildren().add(valueField);
Button send = new Button("Send");
send.setMinWidth(Button.USE_PREF_SIZE);
hbox.getChildren().add(send);
Button clear = new Button("Clear");
clear.setMinWidth(Button.USE_PREF_SIZE);
clear.setOnAction((event) -> clear());
hbox.getChildren().add(clear);
return hbox;
}
示例6: buildButton
import javafx.scene.control.Button; //导入方法依赖的package包/类
private Button buildButton(String text) {
Button button = new Button(text);
button.setMnemonicParsing(false);
button.setMinWidth(USE_PREF_SIZE);
button.setMaxWidth(USE_PREF_SIZE);
button.setPrefWidth(30);
button.setMinHeight(USE_PREF_SIZE);
button.setMaxHeight(USE_PREF_SIZE);
button.setPrefHeight(25);
return button;
}
示例7: 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;
}
示例8: Controls
import javafx.scene.control.Button; //导入方法依赖的package包/类
public Controls(ServerTab tab) {
super();
this.tab = tab;
ToolBar toolbar = new ToolBar();
Button disconnect = new Button("", AssetsLoader.getAssetView("disconnect.png", DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE));
Button broadcast = new Button("", AssetsLoader.getAssetView("broadcast.png", DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE));
Button enableKits = new Button("Allow all kits");
Button disableKits = new Button("Disallow all kits");
Button setNextMap = new Button("", AssetsLoader.getAssetView("next_map.png", DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE));
Button changeMap = new Button("", AssetsLoader.getAssetView("change_map.png", DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE));
Button setSlomo = new Button("Set slomo");
Button resetSlomo = new Button("Reset slomo");
Button enableVClaim = new Button("Enable vehicule claiming");
Button disableVClaim = new Button("Disable vehicule claiming");
disconnect.setTooltip(new Tooltip("Disconnect from server."));
broadcast.setTooltip(new Tooltip("Broadcast a message."));
changeMap.setTooltip(new Tooltip("Change current map. Be careful, this command will immediatly switch to the desired map."));
setNextMap.setTooltip(new Tooltip("Change the next played map."));
disconnect.setOnAction(this::disconnectAction);
enableKits.setOnAction(this::enableKitsAction);
disableKits.setOnAction(this::disableKitsAction);
setNextMap.setOnAction(this::setNextMapAction);
setSlomo.setOnAction(this::setSlomoAction);
resetSlomo.setOnAction(this::resetSlomoAction);
broadcast.setOnAction(this::broadcastAction);
enableVClaim.setOnAction(this::enableVClaimAction);
disableVClaim.setOnAction(this::disableVClaimAction);
changeMap.setOnAction(this::changeMapAction);
toolbar.getItems().add(disconnect);
toolbar.getItems().add(getSeparator());
toolbar.getItems().add(broadcast);
toolbar.getItems().add(getSeparator());
toolbar.getItems().addAll(setNextMap, changeMap);
// XXX not working atm, owi disabled them.
// toolbar.getItems().add(getSeparator());
// toolbar.getItems().addAll(enableKits, disableKits);
// toolbar.getItems().add(getSeparator());
// toolbar.getItems().addAll(setSlomo, resetSlomo);
// toolbar.getItems().add(getSeparator());
// toolbar.getItems().addAll(enableVClaim, disableVClaim);
consoleLogs = new TextArea();
consoleLogs.setEditable(false);
consoleLogs.textProperty().addListener((obs, oldV, newV) -> {
consoleLogs.setScrollTop(Double.MAX_VALUE);
});
manualCommandField = new TextField();
Button manualCommandButton = new Button("Send");
HBox manualPane = new HBox();
manualPane.getChildren().addAll(manualCommandField, manualCommandButton);
manualCommandField.prefWidthProperty().bind(consoleLogs.widthProperty());
manualCommandButton.setMaxWidth(70);
manualCommandButton.setMinWidth(70);
manualCommandButton.setOnAction(this::sendManualCommandAction);
manualCommandField.setOnAction(this::sendManualCommandAction);
this.setTop(toolbar);
this.setCenter(consoleLogs);
this.setBottom(manualPane);
}
示例9: getActionPane
import javafx.scene.control.Button; //导入方法依赖的package包/类
private VBox getActionPane(){
VBox hb = new VBox();
Text cont= new Text("Contents Frame");
cont.setFont(Font.font("Andalus", 19));
VBox lcont= new VBox();
lcont.getChildren().add(cont);
lcont.setPadding(new Insets(20,0,20,0));
hb.setAlignment(Pos.TOP_LEFT);
hb.setPadding(new Insets(0,10,10,10));
hb.setSpacing(10);
hb.setPrefHeight(40);
Button upBtn = new Button("The Main Page");
upBtn.setOnAction(e ->{
timelineUp.play();
});
Button downBtn = new Button("Second Page");
downBtn.setOnAction(e ->{
timelineDown.play();
});
Button thirdBtn = new Button("third Page");
thirdBtn.setOnAction(e ->{
timelinethree.play();
});
Button fourthBtn = new Button("fourth Page");
fourthBtn.setOnAction(e ->{
timelinefour.play();
});
upBtn.setMinWidth(160);
downBtn.setMinWidth(145);
thirdBtn.setMinWidth(130);
fourthBtn.setMinWidth(115);
hb.getChildren().addAll(lcont,upBtn, downBtn, thirdBtn, fourthBtn);
hb.setMinWidth(200);
return hb;
}