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

The following examples show how to use javafx.scene.control.Button#setOnMouseClicked() . 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: ContainerOverviewPanelSkin.java    From phoenicis with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Creates a {@link HBox} containing the management buttons for the container
 *
 * @return The created {@link HBox}
 */
private HBox createManagementButtonContainer() {
    final Button deleteButton = new Button(tr("Delete container"));
    deleteButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnDeleteContainer())
            .ifPresent(onDeleteContainer -> onDeleteContainer.accept(getControl().getContainer())));

    final Button changeEngineVersionButton = new Button(tr("Change engine version"));
    changeEngineVersionButton
            .setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnChangeEngineVersion())
                    .ifPresent(onChangeEngine -> onChangeEngine.accept(getControl().getContainer())));

    final Button openFileBrowserButton = new Button(tr("Open in file browser"));
    openFileBrowserButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnOpenFileBrowser())
            .ifPresent(onOpenFileBrowser -> onOpenFileBrowser.accept(getControl().getContainer())));

    return new HBox(deleteButton, changeEngineVersionButton, openFileBrowserButton);
}
 
Example 2
Source File: AbstractStepRepresentation.java    From phoenicis with GNU Lesser General Public License v3.0 6 votes vote down vote up
protected void drawFooter() {
    HBox footer = new HBox();
    footer.setAlignment(Pos.CENTER_RIGHT);
    footer.setPadding(new Insets(8));
    footer.setSpacing(10);
    footer.setPrefHeight(45);
    footer.setId("footer");
    getParent().getRoot().setBottom(footer);

    Button cancelButton = new Button(tr("Cancel"));

    nextButton = new Button(tr("Next"));

    footer.getChildren().addAll(cancelButton, nextButton);

    cancelButton.setOnMouseClicked(event -> {
        cancelButton.setDisable(true);
        messageWaitingForResponse.sendCancelSignal();
    });
}
 
Example 3
Source File: XYPlotRepresentation.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Pane createJFXNode() throws Exception
{
    // Plot is only active in runtime mode, not edit mode
    plot = new RTValuePlot(! toolkit.isEditMode());
    plot.setUpdateThrottle(Preferences.plot_update_delay, TimeUnit.MILLISECONDS);
    plot.showToolbar(false);
    plot.showCrosshair(false);
    plot.setManaged(false);

    // Create PlotMarkers once. Not allowing adding/removing them at runtime
    if (! toolkit.isEditMode())
        for (MarkerProperty marker : model_widget.propMarkers().getValue())
            createMarker(marker);

    // Add button to reset ranges of X and Y axes to the values when plot was first rendered.
    Button resetAxisRanges =
            plot.addToolItem(JFXUtil.getIcon("reset_axis_ranges.png"), Messages.Reset_Axis_Ranges);

    resetAxisRanges.setOnMouseClicked(me -> {
        plot.resetAxisRanges();
    });

    return plot;
}
 
Example 4
Source File: UpdatesView.java    From Maus with GNU General Public License v3.0 5 votes vote down vote up
private HBox getAboutPanel() {
    Label title = (Label) Styler.styleAdd(new Label("Maus 2.0b"), "title");
    Text desc = (Text) Styler.styleAdd(new Text("Maus is a lightweight remote administrative tool " +
            "written in Java \nby a single developer. Maus is intended to present necessary \nfeatures in an attractive and " +
            "easy to use UI."), "");
    Button checkUpdates = new Button("Check for Updates");
    checkUpdates.setOnMouseClicked(event -> {
        Platform.runLater(() -> NotificationView.openNotification("Update Check Complete"));

        HBox hBox = getUpdatesPanel();
        hBox.setId("updatesView");
        updatesView.setCenter(hBox);
    });
    return Styler.hContainer(Styler.vContainer(10, title, desc, checkUpdates));
}
 
Example 5
Source File: JaceUIController.java    From jace with GNU General Public License v2.0 5 votes vote down vote up
private void connectButtons(Node n) {
    if (n instanceof Button) {
        Button button = (Button) n;
        Runnable action = Utility.getNamedInvokableAction(button.getText());
        button.setOnMouseClicked(evt -> action.run());
    } else if (n instanceof Parent) {
        for (Node child : ((Parent) n).getChildrenUnmodifiable()) {
            connectButtons(child);
        }
    }
}
 
Example 6
Source File: ShortcutEditingPanelSkin.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    final Label descriptionLabel = new Label();
    descriptionLabel.textProperty().bind(description);
    descriptionLabel.setWrapText(true);

    final GridPane propertiesGrid = createPropertiesGrid();

    final Label environmentLabel = new Label(tr("Environment"));
    environmentLabel.getStyleClass().add("sectionTitle");
    environmentLabel.setWrapText(true);

    final KeyAttributeList environmentAttributeList = createKeyAttributeList();

    final Region spacer = new Region();
    spacer.getStyleClass().add("detailsButtonSpacer");

    final Button saveButton = new Button(tr("Save"));
    saveButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutChanged()).ifPresent(
            onShortcutChanged -> onShortcutChanged.accept(getControl().getShortcut())));

    final VBox container = new VBox(descriptionLabel, propertiesGrid, environmentLabel, environmentAttributeList,
            spacer, saveButton);

    getChildren().setAll(container);
}
 
Example 7
Source File: LibrarySidebarSkin.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Creates a {@link SidebarGroup} which contains the advanced tool buttons to:
 * <ul>
 * <li>create a new shortcut</li>
 * <li>run a script</li>
 * <li>open a Phoenicis console</li>
 * </ul>
 *
 * @return The created {@link SidebarGroup} object
 */
private SidebarGroup<Button> createAdvancedToolsGroup() {
    final Button createShortcut = new Button(tr("Create shortcut"));
    createShortcut.getStyleClass().addAll("sidebarButton", "openTerminal");
    createShortcut.setOnMouseClicked(
            event -> Optional.ofNullable(getControl().getOnCreateShortcut()).ifPresent(Runnable::run));

    final Button runScript = new Button(tr("Run a script"));
    runScript.getStyleClass().addAll("sidebarButton", "scriptButton");
    runScript.setOnMouseClicked(event -> {
        final FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle(tr("Open Script..."));

        final File scriptToRun = fileChooser.showOpenDialog(getControl().getScene().getWindow());

        if (scriptToRun != null) {
            Optional.ofNullable(getControl().getOnScriptRun())
                    .ifPresent(onScriptRun -> onScriptRun.accept(scriptToRun));
        }
    });

    final Button runConsole = new Button(tr("{0} console", getControl().getApplicationName()));
    runConsole.getStyleClass().addAll("sidebarButton", "consoleButton");
    runConsole.setOnMouseClicked(
            event -> Optional.ofNullable(getControl().getOnOpenConsole()).ifPresent(Runnable::run));

    final SidebarGroup<Button> advancedToolsGroup = new SidebarGroup<>(tr("Advanced Tools"));
    advancedToolsGroup.getComponents().addAll(createShortcut, /* runScript, */runConsole);

    return advancedToolsGroup;
}
 
Example 8
Source File: ShortcutInformationPanelSkin.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new {@link GridPane} containing the control buttons for the selected shortcut.
 * These control buttons consist of:
 * <ul>
 * <li>The run button</li>
 * <li>The stop button</li>
 * <li>The uninstall button</li>
 * </ul>
 *
 * @return A new {@link GridPane} containing the control buttons for the selected shortcut
 */
private GridPane createControlButtons() {
    final GridPane controlButtons = new GridPane();
    controlButtons.getStyleClass().add("shortcut-control-button-group");

    ColumnConstraints runColumn = new ColumnConstraintsWithPercentage(25);
    ColumnConstraints stopColumn = new ColumnConstraintsWithPercentage(25);
    ColumnConstraints uninstallColumn = new ColumnConstraintsWithPercentage(25);
    ColumnConstraints editColumn = new ColumnConstraintsWithPercentage(25);

    controlButtons.getColumnConstraints().addAll(runColumn, stopColumn, uninstallColumn, editColumn);

    final Button runButton = new Button(tr("Run"));
    runButton.getStyleClass().addAll("shortcutButton", "runButton");
    runButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutRun())
            .ifPresent(onShortcutRun -> onShortcutRun.accept(getControl().getShortcut())));
    GridPane.setHalignment(runButton, HPos.CENTER);

    final Button stopButton = new Button(tr("Close"));
    stopButton.getStyleClass().addAll("shortcutButton", "stopButton");
    stopButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutStop())
            .ifPresent(onShortcutStop -> onShortcutStop.accept(getControl().getShortcut())));
    GridPane.setHalignment(stopButton, HPos.CENTER);

    final Button uninstallButton = new Button(tr("Uninstall"));
    uninstallButton.getStyleClass().addAll("shortcutButton", "uninstallButton");
    uninstallButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutUninstall())
            .ifPresent(onShortcutUninstall -> onShortcutUninstall.accept(getControl().getShortcut())));
    GridPane.setHalignment(uninstallButton, HPos.CENTER);

    final Button editButton = new Button(tr("Edit"));
    editButton.getStyleClass().addAll("shortcutButton", "editButton");
    editButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutEdit())
            .ifPresent(onShortcutEdit -> onShortcutEdit.accept(getControl().getShortcut())));
    GridPane.setHalignment(editButton, HPos.CENTER);

    controlButtons.addRow(0, runButton, stopButton, uninstallButton, editButton);

    return controlButtons;
}
 
Example 9
Source File: ApplicationInformationPanelSkin.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Refreshes the shown scripts.
 * When this method is called it begins by clearing the <code>scriptGrid</code>.
 * Afterwards this method refills it.
 */
private void updateScripts(final GridPane scriptGrid) {
    scriptGrid.getChildren().clear();

    for (int i = 0; i < filteredScripts.size(); i++) {
        ScriptDTO script = filteredScripts.get(i);

        final Label scriptName = new Label(script.getScriptName());
        GridPane.setHgrow(scriptName, Priority.ALWAYS);

        if (getControl().isShowScriptSource()) {
            final Tooltip tooltip = new Tooltip(tr("Source: {0}", script.getScriptSource()));
            Tooltip.install(scriptName, tooltip);
        }

        final Button installButton = new Button(tr("Install"));
        installButton.setOnMouseClicked(evt -> {
            try {
                installScript(script);
            } catch (IllegalArgumentException e) {
                final ErrorDialog errorDialog = ErrorDialog.builder()
                        .withMessage(tr("Error while trying to download the installer"))
                        .withException(e)
                        .build();

                errorDialog.showAndWait();
            }
        });

        scriptGrid.addRow(i, scriptName, installButton);
    }
}
 
Example 10
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 11
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 12
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 13
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 14
Source File: CActionButton.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) {

	if (this.conditionalshow) {
		DataElt thiselement = inputdata.lookupDataElementByName(conditionalshowdatareference.getName());
		if (thiselement == null)
			throw new RuntimeException(String.format(
					"could not find any page data with name = %s" + conditionalshowdatareference.getName()));
		if (!thiselement.getType().equals(conditionalshowdatareference.getType()))
			throw new RuntimeException(
					String.format("page data with name = %s does not have expected %s type, actually found %s",
							conditionalshowdatareference.getName(), conditionalshowdatareference.getType(),
							thiselement.getType()));
		ChoiceDataElt<?> thischoiceelement = (ChoiceDataElt<?>) thiselement;
		if (thischoiceelement.getStoredValue().compareTo("YES") != 0)
			return new Label("");
	}

	button = new Button(label);
	button.setStyle("-fx-base: #ffffff; -fx-hover-base: #ddeeff;");
	button.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE);
	button.textOverrunProperty().set(OverrunStyle.CLIP);
	// button.setMinWidth((new
	// Text(this.label).getBoundsInLocal().getWidth()+20)*1.3);
	if (tooltip != null)
		button.setTooltip(new Tooltip("tooltip"));
	if (!this.hasconfirmationmessage) {
		if (action != null) {
			actionmanager.registerEvent(button, action);
			if (callback != null)
				actionmanager.registerCallback(button, callback);
			buttonhandler = new ButtonHandler(actionmanager);
			button.setOnMouseClicked(buttonhandler);
		}
		if (inlineaction != null) {
			if (nodetocollapsewhenactiontriggered != null)
				inlineaction.setNodeToCollapse(nodetocollapsewhenactiontriggered);
			if (this.forcepopuphidewheninline) {
				actionmanager.registerInlineActionwithPopupClose(button, inlineaction);
			} else {
				actionmanager.registerInlineAction(button, inlineaction);
			}
			buttonhandler = new ButtonHandler(actionmanager);
			button.setOnMouseClicked(buttonhandler);
		}
	}
	if (this.hasconfirmationmessage) {
		button.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent arg0) {
				Alert alert = new Alert(AlertType.CONFIRMATION);
				alert.setTitle("User Confirmation");
				alert.setContentText(confirmationmessage);
				ButtonType continuetype = new ButtonType(confirmationmessagecontinuelabel);
				ButtonType stoptype = new ButtonType(confirmationmessagestoplabel);
				alert.getButtonTypes().setAll(continuetype, stoptype);
				Optional<ButtonType> result = alert.showAndWait();
				if (result.get() == continuetype) {

					if (action != null) {
						if (callback != null)
							actionmanager.directfireEvent(action, callback);
						if (callback == null)
							actionmanager.directfireEvent(action);
					}
					if (inlineaction != null) {
						if (forcepopuphidewheninline)
							inlineaction.forcePopupClose();
						actionmanager.directfireInlineEvent(inlineaction);
					}
				}

			}

		});
	}

	return button;
}
 
Example 15
Source File: ContainerToolsPanelSkin.java    From phoenicis with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Creates the container for the tool buttons
 *
 * @return The container with the tool buttons
 */
private TilePane createToolsContainer() {
    final TilePane toolsContainer = new TilePane();

    final Button runExecutable = new Button(tr("Run executable"));
    runExecutable.getStyleClass().addAll("toolButton", "runExecutable");
    runExecutable.setOnMouseClicked(event -> {
        getControl().setLockTools(true);

        final FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle(tr("Choose executable..."));

        // open in container directory if it exists
        final File containerDir = new File(getControl().getContainer().getPath());
        if (containerDir.canRead()) {
            fileChooser.setInitialDirectory(containerDir);
        }

        final File file = fileChooser.showOpenDialog(getControl().getScene().getWindow());
        if (file != null) {
            final ContainerDTO container = getControl().getContainer();
            final String engineId = container.getEngine().toLowerCase();

            getControl().getEnginesManager().getEngine(engineId,
                    engine -> {
                        engine.setWorkingContainer(container.getName());
                        engine.run(file.getAbsolutePath(), new String[0], container.getPath(), false, true,
                                new HashMap<>());

                        getControl().setLockTools(false);
                    },
                    exception -> Platform.runLater(() -> {
                        final ErrorDialog errorDialog = ErrorDialog.builder()
                                .withMessage(tr("Error"))
                                .withOwner(getControl().getScene().getWindow())
                                .withException(exception)
                                .build();

                        errorDialog.showAndWait();
                    }));
        } else {
            // unlock if file chooser is closed
            getControl().setLockTools(false);
        }
    });

    toolsContainer.getChildren().add(runExecutable);

    return toolsContainer;
}
 
Example 16
Source File: WebPanel.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
private void setupNavigationBarContent() {
    back = new Button("", getButtonImageView("file:icons/arrow-back.png"));
    back.setOnMouseClicked(e -> {
        if (wd != null) {
            wd.back();
        }
    });
    forward = new Button("", getButtonImageView("file:icons/arrow-forward.png"));
    forward.setOnMouseClicked(e -> {
        if (wd != null) {
            wd.forward();
        }
    });
    reload = new Button("", getButtonImageView("file:icons/reload.png"));
    reload.setOnMouseClicked(e -> {
        if (wd != null) {
            wd.reload();
        }
    });
    url = new TextField();
    url.setPrefHeight(32);
    url.setMaxHeight(32);
    url.setStyle(""
            + "-fx-font-size: 14px;"
            + "-fx-font-weight: bold;"
            + "-fx-font-family: fantasy;");
    url.setTooltip(new Tooltip("Change URL"));
    url.setOnKeyReleased(e -> {
        if (e.getCode().equals(KeyCode.ENTER)) {
            if (wd != null) {
                wd.setUrl(url.getText());
            }
        }
    });
    go = new Button("", getButtonImageView("file:icons/send.png"));
    go.setOnMouseClicked(e -> {
        if (wd != null) {
            wd.setUrl(url.getText());
        }
    });
    plus = new Button("", getButtonImageView("file:icons/zoom-in.png"));
    plus.setOnMouseClicked(e -> {
        if (wd != null) {
            wd.zoom(true);
        }
    });
    minus = new Button("", getButtonImageView("file:icons/zoom-out.png"));
    minus.setOnMouseClicked(e -> {
        if (wd != null) {
            wd.zoom(false);
        }
    });
}
 
Example 17
Source File: dashboardBase.java    From Client with MIT License 4 votes vote down vote up
private VBox getSettingsPane()
{
    //This returns the entire Settings Pane node

    //base pane for the nodes in settings pane
    VBox settingsVBox = new VBox();
    settingsVBox.getStyleClass().add("pane");
    settingsVBox.setSpacing(5);

    //1st row, contains settings heading and the close button
    HBox row1 = new HBox();
    Label headingLabel = new Label("Settings");
    headingLabel.getStyleClass().add("h2");
    headingLabel.setPadding(new Insets(0,0,10,0));
    Region r1 = new Region();
    HBox.setHgrow(r1, Priority.ALWAYS);
    Button settingsCloseButton = new Button();
    settingsCloseButton.setGraphic(new ImageView());
    settingsCloseButton.setOnMouseClicked(event -> closeSettings());

    row1.getChildren().addAll(headingLabel, r1, settingsCloseButton);

    //2nd row, contains server ip text field
    HBox row2 = new HBox();
    row1.setSpacing(5);
    Label serverIPLabel = new Label("Server IP");
    Region r2 = new Region();
    HBox.setHgrow(r2,Priority.ALWAYS);
    serverIPTextField = new TextField();
    row2.getChildren().addAll(serverIPLabel, r2, serverIPTextField);

    //3rd row, contains server port text field
    HBox row3 = new HBox();
    row2.setSpacing(5);
    Label serverPortLabel = new Label("Server Port");
    Region r3 = new Region();
    HBox.setHgrow(r3,Priority.ALWAYS);
    serverPortTextField = new TextField();
    row3.getChildren().addAll(serverPortLabel, r3, serverPortTextField);

    //4th row, contains device nickname text field
    HBox row4 = new HBox();
    row4.setSpacing(5);
    Label deviceNicknameLabel = new Label("Device Nickname");
    Region r4 = new Region();
    HBox.setHgrow(r4, Priority.ALWAYS);
    deviceNicknameTextField = new TextField();
    row4.getChildren().addAll(deviceNicknameLabel, r4, deviceNicknameTextField);

    //5th row, connection status
    connectionStatusLabel = new Label();

    //6th row, contains the buttons for settings
    HBox row6 = new HBox();
    row6.setAlignment(Pos.CENTER);
    row6.setSpacing(10);

    connectDisconnectButton = new Button("Connect");
    connectDisconnectButton.getStyleClass().add("btn-green");
    //assign onclick to the button
    connectDisconnectButton.setOnMouseClicked(event -> onConnectDisconnectButtonClicked());

    Button applySettingsButton = new Button("Apply Settings");
    applySettingsButton.getStyleClass().add("btn-green");
    //assign onclick to the button
    applySettingsButton.setOnMouseClicked(event -> onApplySettingsButtonClicked());

    row6.getChildren().addAll(connectDisconnectButton, applySettingsButton);

    //7th row, contains the buttons for settings
    HBox row7 = new HBox();
    row7.setAlignment(Pos.CENTER);
    row7.setSpacing(10);
    Button restartButton = new Button("Restart");
    restartButton.getStyleClass().add("btn-orange");
    restartButton.setOnMouseClicked(event -> onRestartButtonClicked());

    Button shutdownButton = new Button("Shutdown");
    shutdownButton.getStyleClass().add("btn-orange");
    shutdownButton.setOnMouseClicked(event -> onShutdownButtonClicked());

    Button quitButton = new Button("Quit");
    quitButton.getStyleClass().add("btn-red");
    quitButton.setOnMouseClicked(event -> onQuitButtonClicked());

    row7.getChildren().addAll(restartButton, shutdownButton, quitButton);

    //add the children to the settings vbox, and return it
    settingsVBox.getChildren().addAll(row1, row2, row3, row4, connectDisconnectButton, row6, row7);
    return settingsVBox;
}
 
Example 18
Source File: dashboardBase.java    From Client with MIT License 4 votes vote down vote up
public void loadNodes()
{
    //runs after config has been loaded

    //Load font
    Font.loadFont(getClass().getResource("Roboto.ttf").toExternalForm().replace("%20",""), 13);

    //apply stylesheet
    getStylesheets().add(getClass().getResource("style.css").toExternalForm());

    //add style "pane" for every pane (dashboardBase itself is a pane with many panes)
    getStyleClass().add("pane");
    //apply current theme
    setStyle("bg-color: "+config.get("bg-color")+";font-color: "+config.get("font-color")+";");



    //init of base nodes

    //bottomButtonBar - will contain the Settings Button
    bottomButtonBar = new HBox();
    bottomButtonBar.getStyleClass().add("pane");
    bottomButtonBar.setAlignment(Pos.CENTER_RIGHT);
    settingsButton = new Button();
    settingsButton.setGraphic(getIcon("gmi-settings"));
    settingsButton.setOnMouseClicked(event -> {
        if(currentPane == PANE.settings)
        {
            closeSettings();
            currentPane = PANE.actions;
        }
        else
            switchPane(PANE.settings);
    });
    bottomButtonBar.getChildren().add(settingsButton);



    //mainPane - will contain actionsPane, settingsPane and also goodbyePane
    mainPane = new StackPane();
    mainPane.setPadding(new Insets(10,10,0,10));
    mainPane.getStyleClass().add("pane");

    //Init children of mainPane
    actionsPane = new StackPane(); // Where actions will be stored
    actionsPane.getStyleClass().add("pane"); //Adding stylesheet class to actionsPane

    settingsPane = getSettingsPane(); // Will contain Settings

    goodbyePane = getGoodbyePane(); // Will contain goodbye message

    loadingPane = getLoadingPane(); // Will contain loading spinner and a message

    //add children of mainPane to mainPane
    mainPane.getChildren().addAll(actionsPane, settingsPane, goodbyePane, loadingPane);



    //set all the children nodes opacity to 0
    //actionsPane.setOpacity(0);
    //settingsPane.setOpacity(0);
    //goodbyePane.setOpacity(0);
    //loadingPane.setOpacity(0);
    //settingsPane.toFront();

    //enable caching to improve performance (Especially on embedded and Mobile)
    actionsPane.setCache(true);
    actionsPane.setCacheHint(CacheHint.SPEED);

    settingsPane.setCache(true);
    settingsPane.setCacheHint(CacheHint.SPEED);

    loadingPane.setCache(true);
    loadingPane.setCacheHint(CacheHint.SPEED);

    goodbyePane.setCache(true);
    goodbyePane.setCacheHint(CacheHint.SPEED);

    settingsButton.setCache(true);
    settingsButton.setCacheHint(CacheHint.SPEED);

    setCache(true);
    setCacheHint(CacheHint.SPEED);

    //finally add base nodes to the base Scene
    setCenter(mainPane);
    setBottom(bottomButtonBar);
}