当前位置: 首页>>代码示例>>Java>>正文


Java Button.setMaxWidth方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:PolyphasicDevTeam,项目名称:NoMoreOversleeps,代码行数:37,代码来源:MainDialog.java

示例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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:31,代码来源:CheckListView.java

示例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;
}
 
开发者ID:PolyphasicDevTeam,项目名称:NoMoreOversleeps,代码行数:8,代码来源:JavaFxHelper.java

示例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;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:36,代码来源:HelloPerformance.java

示例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);
}
 
开发者ID:hendrikebbers,项目名称:ExtremeGuiMakeover,代码行数:28,代码来源:FeaturesPane.java

示例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);
    }
}
 
开发者ID:scourgemancer,项目名称:graphing-loan-analyzer,代码行数:32,代码来源:CalendarViewSkin.java

示例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;
}
 
开发者ID:Kindrat,项目名称:cassandra-client,代码行数:13,代码来源:TableButtons.java

示例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();		
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:28,代码来源:LosePresentation.java

示例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();		
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:29,代码来源:WinPresentation.java

示例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);
	}
 
开发者ID:ScreachFr,项目名称:titanium,代码行数:78,代码来源:Controls.java

示例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;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:54,代码来源:HelloSourceView.java

示例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;
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:7,代码来源:PasswordManager.java


注:本文中的javafx.scene.control.Button.setMaxWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。