本文整理汇总了Java中javafx.scene.control.Button.setMaxWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setMaxWidth方法的具体用法?Java Button.setMaxWidth怎么用?Java Button.setMaxWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Button
的用法示例。
在下文中一共展示了Button.setMaxWidth方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: initVerticalButtonBar
import javafx.scene.control.Button; //导入方法依赖的package包/类
private void initVerticalButtonBar() {
verticalButtonBar = new VBox();
Button upButton = FXUIUtils.createButton("up", "Move selection up", true, "Up");
upButton.setMaxWidth(Double.MAX_VALUE);
upButton.setOnAction((e) -> {
checkListFormNode.moveUpSelected();
if (checkListFormNode.isDirty()) {
fireContentChanged();
}
});
Button deleteButton = FXUIUtils.createButton("remove", "Delete selection", true, "Remove");
deleteButton.setOnAction((e) -> {
checkListFormNode.deleteSelected();
if (checkListFormNode.isDirty()) {
fireContentChanged();
}
});
Button downButton = FXUIUtils.createButton("down", "Move selection down", true, "Down");
downButton.setOnAction((e) -> {
checkListFormNode.moveDownSelected();
if (checkListFormNode.isDirty()) {
fireContentChanged();
}
});
downButton.setMaxWidth(Double.MAX_VALUE);
verticalButtonBar.getChildren().addAll(upButton, deleteButton, downButton);
}
示例3: createButtonMaxW
import javafx.scene.control.Button; //导入方法依赖的package包/类
public static Button createButtonMaxW(String text, double width)
{
Button button = createButton();
button.setText(text);
button.setMaxWidth(width);
return button;
}
示例4: getControlPanel
import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
public Node getControlPanel() {
VBox vBox = new VBox();
vBox.setFillWidth(true);
vBox.setSpacing(10);
// button
Button button = new Button("Create Entries");
button.setMaxWidth(Double.MAX_VALUE);
button.setOnAction(evt -> createEntries());
VBox.setVgrow(button, Priority.NEVER);
vBox.getChildren().add(button);
// box
comboBox = new ComboBox<>();
comboBox.getItems().addAll(100, 1000, 2000, 3000, 10000, 100000, 1000000);
comboBox.getSelectionModel().select(0);
comboBox.setMaxWidth(Double.MAX_VALUE);
vBox.getChildren().add(comboBox);
// label
label = new Label("Time: ");
vBox.getChildren().add(label);
// Separator
Separator separator = new Separator(Orientation.HORIZONTAL);
vBox.getChildren().add(separator);
// sheet
CalendarPropertySheet sheet = new CalendarPropertySheet(calendarView.getPropertySheetItems());
VBox.setVgrow(sheet, Priority.ALWAYS);
vBox.getChildren().add(sheet);
return vBox;
}
示例5: 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);
}
示例6: createCells
import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
protected void createCells() {
final Calendar calendar = calendarView.getCalendar();
// For each year in the decade, add a button to the view.
for (int i = 0; i < NUMBER_OF_DECADES * 10; i++) {
final Button button = new Button();
button.getStyleClass().add(CSS_CALENDAR_DECADES_VIEW_BUTTON);
button.setMaxWidth(Double.MAX_VALUE);
button.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(button, Priority.ALWAYS);
GridPane.setHgrow(button, Priority.ALWAYS);
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
if (currentlyViewing.get() == View.DECADES) {
calendar.set(Calendar.YEAR, (Integer) button.getUserData());
currentlyViewing.set(View.YEAR);
calendarView.viewedDateProperty().set(calendar.getTime());
}
}
});
int rowIndex = i % 5;
int colIndex = (i - rowIndex) / 5;
add(button, rowIndex, colIndex);
}
}
示例7: 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;
}
示例8: show
import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
public void show(ResultAccessor result) {
primaryStage.setTitle("Loser");
Group root = new Group();
Button playButton = new Button("restart");
playButton.setMaxWidth(Double.MAX_VALUE);
playButton.setOnAction( e -> restartAction());
Button exitButton = new Button("exit");
exitButton.setMaxWidth(Double.MAX_VALUE);
exitButton.setOnAction(e -> exitAction());
vbButtons.getChildren().add(playButton);
vbButtons.getChildren().add(exitButton);
vbTexts.getChildren().add(getText("You're a Loser!"));
vbTexts.getChildren().add(getText("For this game: " + result.getGameName()));
vbTexts.getChildren().add(getText("You get the score: " + result.getPoint()));
vbTexts.getChildren().add(getText("Your health is: " + result.getHealth()));
root.getChildren().add(vbTexts);
root.getChildren().addAll(vbButtons);
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
}
示例9: show
import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
public void show(ResultAccessor result) {
primaryStage.setTitle("Winner");
Group root = new Group();
Button playButton = new Button("restart");
playButton.setMaxWidth(Double.MAX_VALUE);
playButton.setOnAction( e -> restartAction());
Button exitButton = new Button("exit");
exitButton.setMaxWidth(Double.MAX_VALUE);
exitButton.setOnAction(e -> exitAction());
vbButtons.getChildren().add(playButton);
vbButtons.getChildren().add(exitButton);
vbTexts.getChildren().add(getText("Congratulations!"));
vbTexts.getChildren().add(getText("For this game: " + result.getGameName()));
vbTexts.getChildren().add(getText("You get the score: " + result.getPoint()));
vbTexts.getChildren().add(getText("Your health is: " + result.getHealth()));
root.getChildren().add(vbTexts);
root.getChildren().addAll(vbButtons);
//TODO : add animation and background
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
}
示例10: 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);
}
示例11: getControlPanel
import javafx.scene.control.Button; //导入方法依赖的package包/类
@Override
public Node getControlPanel() {
VBox box = new VBox();
box.setSpacing(5);
box.setFillWidth(true);
Button addWorkCalendar = new Button("Add Work Calendar");
addWorkCalendar.setOnAction(evt -> addWorkCalendar());
Button removeWorkCalendar = new Button("Remove Work Calendar");
removeWorkCalendar.setOnAction(evt -> removeWorkCalendar());
Button addWorkCalendarSource = new Button("Add Work Calendar Source");
addWorkCalendarSource.setOnAction(evt -> addWorkCalendarSource());
Button removeWorkCalendarSource = new Button(
"Remove Work Calendar Source");
removeWorkCalendarSource.setOnAction(evt -> removeWorkCalendarSource());
box.getChildren().addAll(addWorkCalendar, removeWorkCalendar,
addWorkCalendarSource, removeWorkCalendarSource);
Button addFamilyCalendar = new Button("Add Family Calendar");
addFamilyCalendar.setOnAction(evt -> addFamilyCalendar());
Button removeFamilyCalendar = new Button("Remove Family Calendar");
removeFamilyCalendar.setOnAction(evt -> removeFamilyCalendar());
Button addFamilyCalendarSource = new Button(
"Add Family Calendar Source");
addFamilyCalendarSource.setOnAction(evt -> addFamilyCalendarSource());
Button removeFamilyCalendarSource = new Button(
"Remove Family Calendar Source");
removeFamilyCalendarSource
.setOnAction(evt -> removeFamilyCalendarSource());
box.getChildren().addAll(new Separator(Orientation.HORIZONTAL),
addFamilyCalendar, removeFamilyCalendar,
addFamilyCalendarSource, removeFamilyCalendarSource);
addWorkCalendar.setMaxWidth(Double.MAX_VALUE);
removeWorkCalendar.setMaxWidth(Double.MAX_VALUE);
addWorkCalendarSource.setMaxWidth(Double.MAX_VALUE);
removeWorkCalendarSource.setMaxWidth(Double.MAX_VALUE);
addFamilyCalendar.setMaxWidth(Double.MAX_VALUE);
removeFamilyCalendar.setMaxWidth(Double.MAX_VALUE);
addFamilyCalendarSource.setMaxWidth(Double.MAX_VALUE);
removeFamilyCalendarSource.setMaxWidth(Double.MAX_VALUE);
return box;
}
示例12: createButton
import javafx.scene.control.Button; //导入方法依赖的package包/类
private Button createButton(String name, String id){
Button button = new Button(name);
button.setMaxWidth(Double.MAX_VALUE);
button.setId(id);
return button;
}