Java Code Examples for javafx.scene.control.Button#setMaxSize()
The following examples show how to use
javafx.scene.control.Button#setMaxSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomNavigationDrawerSkin.java From WorkbenchFX with Apache License 2.0 | 6 votes |
private Button buildMenuItem(MenuItem item) { Button button = new Button(); button.textProperty().bind(item.textProperty()); button.graphicProperty().bind(item.graphicProperty()); button.disableProperty().bind(item.disableProperty()); button.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); button.getStyleClass().addAll(item.getStyleClass()); button.setOnAction(item.getOnAction()); // Only in cases ALWAYS and SOMETIMES: hide previously hovered button if (!Priority.NEVER.equals(getSkinnable().getMenuHoverBehavior())) { button.addEventHandler(MouseEvent.MOUSE_ENTERED, e -> { // Triggers on hovering over Button if (!isTouchUsed) { if (hoveredBtn != null) { hoveredBtn.hide(); // Hides the previously hovered Button if not null } hoveredBtn = null; // Sets it to null } }); } return button; }
Example 2
Source File: NavigationDrawerSkin.java From WorkbenchFX with Apache License 2.0 | 6 votes |
private Button buildMenuItem(MenuItem item) { Button button = new Button(); button.textProperty().bind(item.textProperty()); button.graphicProperty().bind(item.graphicProperty()); button.disableProperty().bind(item.disableProperty()); button.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); button.getStyleClass().addAll(item.getStyleClass()); button.setOnAction(item.getOnAction()); // Only in cases ALWAYS and SOMETIMES: hide previously hovered button if (!Priority.NEVER.equals(getSkinnable().getMenuHoverBehavior())) { button.addEventHandler(MouseEvent.MOUSE_ENTERED, e -> { // Triggers on hovering over Button if (!isTouchUsed) { if (hoveredBtn != null) { hoveredBtn.hide(); // Hides the previously hovered Button if not null } hoveredBtn = null; // Sets it to null } }); } return button; }
Example 3
Source File: ControlIntensity.java From helloiot with GNU General Public License v3.0 | 6 votes |
@Override public Node constructContent() { VBox vboxroot = new VBox(); vboxroot.setSpacing(10.0); action = new Button(); action.setContentDisplay(ContentDisplay.TOP); action.setFocusTraversable(false); action.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); action.setMnemonicParsing(false); action.getStyleClass().add("buttonbase"); VBox.setVgrow(action, Priority.SOMETIMES); action.setOnAction(this::onAction); slider = new Slider(); slider.setFocusTraversable(false); slider.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); slider.setPrefWidth(20.0); vboxroot.getChildren().addAll(action, slider); initialize(); return vboxroot; }
Example 4
Source File: ButtonBase.java From helloiot with GNU General Public License v3.0 | 5 votes |
@Override public Node constructContent() { button = new Button(); button.setContentDisplay(ContentDisplay.TOP); button.getStyleClass().add("buttonbase"); VBox.setVgrow(button, Priority.SOMETIMES); button.setMaxSize(Integer.MAX_VALUE, Integer.MAX_VALUE); button.setFocusTraversable(false); button.setOnAction(this::onScriptAction); return button; }
Example 5
Source File: ButtonPair.java From helloiot with GNU General Public License v3.0 | 5 votes |
@Override public Node constructContent() { goup = new Button(); goup.setGraphic(IconBuilder.create(IconFontGlyph.FA_SOLID_CHEVRON_UP, 22.0).styleClass("icon-fill").build()); goup.setContentDisplay(ContentDisplay.TOP); goup.getStyleClass().add("buttonbase"); goup.getStyleClass().add("buttonup"); VBox.setVgrow(goup, Priority.SOMETIMES); goup.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); goup.setFocusTraversable(false); goup.setOnAction(event -> { device.sendStatus(roll ? device.rollNextStatus() : device.nextStatus()); }); godown = new Button(); godown.setGraphic(IconBuilder.create(IconFontGlyph.FA_SOLID_CHEVRON_DOWN, 22.0).styleClass("icon-fill").build()); godown.setContentDisplay(ContentDisplay.TOP); godown.getStyleClass().add("buttonbase"); godown.getStyleClass().add("buttondown"); VBox.setVgrow(godown, Priority.SOMETIMES); godown.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); godown.setFocusTraversable(false); godown.setOnAction(event -> { device.sendStatus(roll ? device.rollPrevStatus() : device.prevStatus()); }); // setIconStatus(IconStatus.valueOf("TEXT/ON/OFF")); VBox content = new VBox(goup, godown); content.setSpacing(4); VBox.setVgrow(content, Priority.SOMETIMES); content.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); return content; }
Example 6
Source File: ButtonEngine.java From helloiot with GNU General Public License v3.0 | 5 votes |
@Override public Node constructContent() { button = new Button(); button.setContentDisplay(ContentDisplay.TOP); button.getStyleClass().add("buttonbase"); VBox.setVgrow(button, Priority.SOMETIMES); button.setMaxSize(Integer.MAX_VALUE, Integer.MAX_VALUE); button.setFocusTraversable(false); button.armedProperty().addListener(this::onArmedChanged); button.setOnAction(this::onAction); return button; }
Example 7
Source File: UICodePluginItem.java From tcMenu with Apache License 2.0 | 4 votes |
public UICodePluginItem(CodePluginManager mgr, CodePluginItem item, UICodeAction action, Consumer<CodePluginItem> evt) { super(); this.eventHandler = evt; this.mgr = mgr; this.item = item; titleLabel = new Label(item.getDescription()); titleLabel.setStyle("-fx-font-weight: bold; -fx-font-size: 110%;"); descriptionArea = new Label(item.getExtendedDescription()); descriptionArea.setWrapText(true); descriptionArea.setAlignment(Pos.TOP_LEFT); descriptionArea.setPrefWidth(1900); whichPlugin = new Label("Plugin loading"); whichPlugin.setStyle("-fx-font-size: 90%;"); whichPlugin.setPadding(new Insets(10, 5, 5, 5)); licenseLink = new Hyperlink("License unknown"); licenseLink.setDisable(true); licenseLink.setPadding(new Insets(10, 0, 5, 0)); licenseLink.setStyle("-fx-font-size: 90%;"); vendorLink = new Hyperlink("Vendor unknown"); vendorLink.setDisable(true); vendorLink.setPadding(new Insets(10, 0, 5, 0)); vendorLink.setStyle("-fx-font-size: 90%;"); docsLink = new Hyperlink("No Docs"); docsLink.setDisable(true); docsLink.setPadding(new Insets(10, 0, 5, 0)); docsLink.setStyle("-fx-font-size: 90%;"); infoContainer = new HBox(5); infoContainer.setAlignment(Pos.CENTER_LEFT); infoContainer.getChildren().add(whichPlugin); infoContainer.getChildren().add(docsLink); infoContainer.getChildren().add(licenseLink); infoContainer.getChildren().add(vendorLink); innerBorder = new BorderPane(); innerBorder.setPadding(new Insets(4)); innerBorder.setTop(titleLabel); innerBorder.setCenter(descriptionArea); innerBorder.setBottom(infoContainer); actionButton = new Button(action == UICodeAction.CHANGE ? "Change" : "Select"); actionButton.setStyle("-fx-font-size: 110%; -fx-font-weight: bold;"); actionButton.setMaxSize(2000, 2000); actionButton.setOnAction(event-> eventHandler.accept(item)); setRight(actionButton); setCenter(innerBorder); setItem(item); }