Java Code Examples for javafx.scene.control.Button#setContentDisplay()

The following examples show how to use javafx.scene.control.Button#setContentDisplay() . 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: ControlIntensity.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@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 2
Source File: MetaDeckView.java    From metastone with GNU General Public License v2.0 6 votes vote down vote up
public void displayDecks(List<Deck> decks) {
	contentPane.getChildren().clear();
	for (Deck deck : decks) {
		if (deck.isMetaDeck()) {
			continue;
		}
		ImageView graphic = new ImageView(IconFactory.getClassIcon(deck.getHeroClass()));
		graphic.setFitWidth(48);
		graphic.setFitHeight(48);
		Button deckButton = new Button(deck.getName(), graphic);
		deckButton.setMaxWidth(160);
		deckButton.setMinWidth(160);
		deckButton.setMaxHeight(120);
		deckButton.setMinHeight(120);
		deckButton.setWrapText(true);
		deckButton.setContentDisplay(ContentDisplay.LEFT);
		deckButton.setOnAction(event -> NotificationProxy.sendNotification(GameNotification.ADD_DECK_TO_META_DECK, deck));
		deckButton.setUserData(deck);
		contentPane.getChildren().add(deckButton);
	}
}
 
Example 3
Source File: TitleBar.java    From desktoppanefx with Apache License 2.0 5 votes vote down vote up
protected Button createButtonDetach(InternalWindow internalWindow) {
    Button btnDetach = new Button("", new FontIcon(resolveDetachIcon()));
    btnDetach.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
    btnDetach.getStyleClass().add("internal-window-titlebar-button");
    btnDetach.visibleProperty().bind(detachVisible);
    btnDetach.managedProperty().bind(detachVisible);
    btnDetach.disableProperty().bind(disableDetach);
    btnDetach.setOnMouseClicked(e -> internalWindow.detachOrAttachWindow());
    internalWindow.detachedProperty().addListener((v, o, n) -> btnDetach.setGraphic(new FontIcon(resolveDetachIcon())));
    return btnDetach;
}
 
Example 4
Source File: TitleBar.java    From desktoppanefx with Apache License 2.0 5 votes vote down vote up
protected Button createButtonClose(InternalWindow internalWindow) {
    Button btnClose = new Button("", new FontIcon(MaterialDesign.MDI_WINDOW_CLOSE));
    btnClose.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
    btnClose.getStyleClass().add("internal-window-titlebar-button");
    btnClose.visibleProperty().bind(closeVisible);
    btnClose.managedProperty().bind(closeVisible);
    btnClose.disableProperty().bind(disableClose);
    btnClose.setOnMouseClicked(e -> internalWindow.closeWindow());
    return btnClose;
}
 
Example 5
Source File: TitleBar.java    From desktoppanefx with Apache License 2.0 5 votes vote down vote up
protected Button createButtonMinimize(InternalWindow internalWindow) {
    Button btnMinimize = new Button("", new FontIcon(MaterialDesign.MDI_WINDOW_MINIMIZE));
    btnMinimize.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
    btnMinimize.getStyleClass().add("internal-window-titlebar-button");
    btnMinimize.visibleProperty().bind(minimizeVisible);
    btnMinimize.managedProperty().bind(minimizeVisible);
    btnMinimize.disableProperty().bind(disableMinimize);
    btnMinimize.setOnMouseClicked(e -> internalWindow.minimizeWindow());
    return btnMinimize;
}
 
Example 6
Source File: TitleBar.java    From desktoppanefx with Apache License 2.0 5 votes vote down vote up
protected Button createButtonMaximize(InternalWindow internalWindow) {
    Button btnMaximize = new Button("", new FontIcon(MaterialDesign.MDI_WINDOW_MAXIMIZE));
    btnMaximize.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
    btnMaximize.getStyleClass().add("internal-window-titlebar-button");
    btnMaximize.visibleProperty().bind(maximizeVisible);
    btnMaximize.managedProperty().bind(maximizeVisible);
    btnMaximize.disableProperty().bind(disableMaximize);
    btnMaximize.setOnMouseClicked(e -> internalWindow.maximizeOrRestoreWindow());
    return btnMaximize;
}
 
Example 7
Source File: GraphicButton.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public GraphicButton() {
    super(400,100);
    ImageView imageView = new ImageView(ICON_48);
    Button button = new Button("button", imageView);
    button.setContentDisplay(ContentDisplay.LEFT);
    getChildren().add(button);
}
 
Example 8
Source File: GraphicButton.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public GraphicButton() {
    super(400,100);
    ImageView imageView = new ImageView(ICON_48);
    Button button = new Button("button", imageView);
    button.setContentDisplay(ContentDisplay.LEFT);
    getChildren().add(button);
}
 
Example 9
Source File: ButtonBase.java    From helloiot with GNU General Public License v3.0 5 votes vote down vote up
@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 10
Source File: ButtonPair.java    From helloiot with GNU General Public License v3.0 5 votes vote down vote up
@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 11
Source File: ButtonEngine.java    From helloiot with GNU General Public License v3.0 5 votes vote down vote up
@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 12
Source File: CPopupButton.java    From Open-Lowcode with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Node getNode(
		PageActionManager actionmanager,
		CPageData inputdata,
		Window parentwindow,
		TabPane[] parenttabpanes,
		CollapsibleNode nodetocollapsewhenactiontriggered) {
	Button button = new Button(label);
	button.setStyle("-fx-base: #ffffff; -fx-hover-base: #ddeeff;");
	Label hamburgerlabel = new Label("\u2630");
	hamburgerlabel.setFont(Font.font(hamburgerlabel.getFont().getFamily(), FontWeight.THIN,
			hamburgerlabel.getFont().getSize() * 0.5f));
	button.setGraphic(hamburgerlabel);
	button.setContentDisplay(ContentDisplay.RIGHT);
	button.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE);
	button.textOverrunProperty().set(OverrunStyle.CLIP);
	if (rollovertip != null)
		if (rollovertip.length() > 0)
			button.setTooltip(new Tooltip(rollovertip));

	// --------- setup popup window

	button.setOnAction(new EventHandler<ActionEvent>() {
		@Override
		public void handle(ActionEvent event) {

			try {
				CPopupButton.generateAndShowPopup(button,
						payload.getNode(actionmanager, inputdata, parentwindow, new TabPane[0],nodetocollapsewhenactiontriggered), inputdata,
						parentwindow, allowscroll, showunderwidget);
			} catch (Exception e) {
				logger.severe("Unexpected exception " + e.getMessage());
				for (int i = 0; i < e.getStackTrace().length; i++)
					logger.severe("   + " + e.getStackTrace()[i].toString());
			}
		}
	});

	// ------------------------

	return button;
}