Search in sources :

Example 71 with GridPane

use of javafx.scene.layout.GridPane in project DistributedFractalNetwork by Budder21.

the class OpacityBox method display.

public static double display(ArrowButton button) {
    //TODO this isn't working correctly
    Slider opacityLevel = new Slider(0, 1, (Double) button.getData());
    Label opacityCaption = new Label("Opacity Level:");
    Label opacityValue = new Label(Double.toString(opacityLevel.getValue()));
    Stage window = new Stage();
    window.setTitle("Opacity Picker");
    window.setMinWidth(450);
    window.setMinHeight(100);
    window.initModality(Modality.APPLICATION_MODAL);
    Group root = new Group();
    Scene scene = new Scene(root);
    GridPane grid = new GridPane();
    grid.setPadding(new Insets(10, 10, 10, 10));
    grid.setVgap(10);
    grid.setHgap(70);
    scene.setRoot(grid);
    GridPane.setConstraints(opacityCaption, 0, 1);
    grid.getChildren().add(opacityCaption);
    opacityLevel.valueProperty().addListener(new ChangeListener<Number>() {

        public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
            System.out.println(new_val.doubleValue());
            opacityValue.setText(String.format("%.2f", new_val));
        }
    });
    GridPane.setConstraints(opacityLevel, 1, 1);
    grid.getChildren().add(opacityLevel);
    GridPane.setConstraints(opacityValue, 2, 1);
    grid.getChildren().add(opacityValue);
    Button b = new Button("Submit");
    b.setOnAction(e -> {
        window.close();
    });
    GridPane.setConstraints(b, 2, 2);
    grid.getChildren().add(b);
    window.setOnCloseRequest(e -> {
    });
    window.setScene(scene);
    window.show();
    return opacityLevel.getValue();
}
Also used : Group(javafx.scene.Group) GridPane(javafx.scene.layout.GridPane) Insets(javafx.geometry.Insets) Slider(javafx.scene.control.Slider) Button(javafx.scene.control.Button) Label(javafx.scene.control.Label) Stage(javafx.stage.Stage) Scene(javafx.scene.Scene)

Example 72 with GridPane

use of javafx.scene.layout.GridPane in project POL-POM-5 by PlayOnLinux.

the class WinePrefixContainerInputTab method populate.

private void populate() {
    final VBox inputPane = new VBox();
    final Text title = new TextWithStyle(tr("Input settings"), TITLE_CSS_CLASS);
    inputPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
    inputPane.getChildren().add(title);
    final GridPane inputContentPane = new GridPane();
    inputContentPane.getStyleClass().add("grid");
    final ComboBox<MouseWarpOverride> mouseWarpOverrideComboBox = new ComboBox<>();
    mouseWarpOverrideComboBox.setValue(container.getMouseWarpOverride());
    addItems(mouseWarpOverrideComboBox, MouseWarpOverride.class);
    inputContentPane.add(new TextWithStyle(tr("Mouse Warp Override"), CAPTION_TITLE_CSS_CLASS), 0, 0);
    inputContentPane.add(mouseWarpOverrideComboBox, 1, 0);
    inputContentPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70));
    inputPane.getChildren().addAll(inputContentPane);
    this.setContent(inputPane);
    lockableElements.add(mouseWarpOverrideComboBox);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) ColumnConstraintsWithPercentage(org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage) GridPane(javafx.scene.layout.GridPane) ComboBox(javafx.scene.control.ComboBox) MouseWarpOverride(org.phoenicis.containers.wine.parameters.MouseWarpOverride) Text(javafx.scene.text.Text) VBox(javafx.scene.layout.VBox)

Example 73 with GridPane

use of javafx.scene.layout.GridPane in project POL-POM-5 by PlayOnLinux.

the class WinePrefixContainerWineToolsTab method populate.

private void populate() {
    final VBox toolsPane = new VBox();
    final Text title = new TextWithStyle(tr("Wine tools"), TITLE_CSS_CLASS);
    toolsPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
    toolsPane.getChildren().add(title);
    final GridPane toolsContentPane = new GridPane();
    toolsContentPane.getStyleClass().add("grid");
    Button configureWine = new Button(tr("Configure Wine"));
    configureWine.getStyleClass().addAll("wineToolButton", "configureWine");
    configureWine.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.runInPrefix(container, "winecfg", this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(configureWine, HPos.CENTER);
    Button registryEditor = new Button(tr("Registry Editor"));
    registryEditor.getStyleClass().addAll("wineToolButton", "registryEditor");
    registryEditor.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.runInPrefix(container, "regedit", this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(registryEditor, HPos.CENTER);
    Button rebootWindows = new Button(tr("Windows reboot"));
    rebootWindows.getStyleClass().addAll("wineToolButton", "rebootWindows");
    rebootWindows.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.runInPrefix(container, "wineboot", this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(rebootWindows, HPos.CENTER);
    Button repairVirtualDrive = new Button(tr("Repair virtual drive"));
    repairVirtualDrive.getStyleClass().addAll("wineToolButton", "repairVirtualDrive");
    repairVirtualDrive.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.repairPrefix(container, this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(repairVirtualDrive, HPos.CENTER);
    Button commandPrompt = new Button(tr("Command prompt"));
    commandPrompt.getStyleClass().addAll("wineToolButton", "commandPrompt");
    commandPrompt.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.runInPrefix(container, "wineconsole", this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(commandPrompt, HPos.CENTER);
    Button taskManager = new Button(tr("Task manager"));
    taskManager.getStyleClass().addAll("wineToolButton", "taskManager");
    taskManager.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.runInPrefix(container, "taskmgr", this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(taskManager, HPos.CENTER);
    Button killProcesses = new Button(tr("Kill processes"));
    killProcesses.getStyleClass().addAll("wineToolButton", "killProcesses");
    killProcesses.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.killProcesses(container, this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(killProcesses, HPos.CENTER);
    Button uninstallWine = new Button(tr("Wine uninstaller"));
    uninstallWine.getStyleClass().addAll("wineToolButton", "uninstallWine");
    uninstallWine.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.runInPrefix(container, "uninstaller", this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(uninstallWine, HPos.CENTER);
    this.lockableElements.addAll(Arrays.asList(configureWine, registryEditor, rebootWindows, repairVirtualDrive, commandPrompt, taskManager, uninstallWine));
    toolsContentPane.add(configureWine, 0, 0);
    toolsContentPane.add(wineToolCaption(tr("Configure Wine")), 0, 1);
    toolsContentPane.add(registryEditor, 1, 0);
    toolsContentPane.add(wineToolCaption(tr("Registry Editor")), 1, 1);
    toolsContentPane.add(rebootWindows, 2, 0);
    toolsContentPane.add(wineToolCaption(tr("Windows reboot")), 2, 1);
    toolsContentPane.add(repairVirtualDrive, 3, 0);
    toolsContentPane.add(wineToolCaption(tr("Repair virtual drive")), 3, 1);
    toolsContentPane.add(commandPrompt, 0, 3);
    toolsContentPane.add(wineToolCaption(tr("Command prompt")), 0, 4);
    toolsContentPane.add(taskManager, 1, 3);
    toolsContentPane.add(wineToolCaption(tr("Task manager")), 1, 4);
    toolsContentPane.add(killProcesses, 2, 3);
    toolsContentPane.add(wineToolCaption(tr("Kill processes")), 2, 4);
    toolsContentPane.add(uninstallWine, 3, 3);
    toolsContentPane.add(wineToolCaption(tr("Wine uninstaller")), 3, 4);
    toolsPane.getChildren().addAll(toolsContentPane);
    toolsContentPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(25), new ColumnConstraintsWithPercentage(25), new ColumnConstraintsWithPercentage(25), new ColumnConstraintsWithPercentage(25));
    this.setContent(toolsPane);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) ColumnConstraintsWithPercentage(org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage) GridPane(javafx.scene.layout.GridPane) Button(javafx.scene.control.Button) Text(javafx.scene.text.Text) ErrorMessage(org.phoenicis.javafx.views.common.ErrorMessage) VBox(javafx.scene.layout.VBox)

Example 74 with GridPane

use of javafx.scene.layout.GridPane in project POL-POM-5 by PlayOnLinux.

the class LibraryPanel method setShortcutDTO.

public void setShortcutDTO(ShortcutDTO shortcutDTO) {
    this.setTitle(shortcutDTO.getName());
    this.getChildren().clear();
    final VBox vBox = new VBox();
    Label description = new Label(shortcutDTO.getDescription());
    description.setWrapText(true);
    final GridPane gridPane = new GridPane();
    gridPane.getStyleClass().add("grid");
    try {
        LOGGER.info("Reading shortcut: {}", shortcutDTO.getScript());
        final Map<String, Object> shortcutProperties = objectMapper.readValue(shortcutDTO.getScript(), new TypeReference<Map<String, Object>>() {
        });
        int i = 0;
        for (String shortcutKey : shortcutProperties.keySet()) {
            final Label keyLabel = new Label(tr(unCamelize(shortcutKey)) + ":");
            keyLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
            GridPane.setValignment(keyLabel, VPos.TOP);
            gridPane.add(keyLabel, 0, i);
            final Label valueLabel = new Label(shortcutProperties.get(shortcutKey).toString());
            valueLabel.setWrapText(true);
            gridPane.add(valueLabel, 1, i);
            i++;
        }
    } catch (IOException e) {
        LOGGER.warn("Could not parse shortcut script JSON", e);
    }
    gridPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70));
    Region spacer = new Region();
    spacer.setPrefHeight(40);
    HBox buttons = new HBox();
    buttons.setAlignment(Pos.CENTER);
    Button runButton = new Button(tr("Run"));
    runButton.getStyleClass().addAll("shortcutButton", "runButton");
    runButton.setOnMouseClicked(event -> onShortcutRun.accept(shortcutDTO));
    Button stopButton = new Button(tr("Close"));
    stopButton.getStyleClass().addAll("shortcutButton", "stopButton");
    stopButton.setOnMouseClicked(event -> onShortcutStop.accept(shortcutDTO));
    Button uninstallButton = new Button(tr("Uninstall"));
    uninstallButton.getStyleClass().addAll("shortcutButton", "uninstallButton");
    uninstallButton.setOnMouseClicked(event -> onShortcutUninstall.accept(shortcutDTO));
    buttons.getChildren().addAll(runButton, stopButton, uninstallButton);
    vBox.getChildren().addAll(description, gridPane, spacer, buttons);
    this.setCenter(vBox);
}
Also used : HBox(javafx.scene.layout.HBox) GridPane(javafx.scene.layout.GridPane) Label(javafx.scene.control.Label) IOException(java.io.IOException) ColumnConstraintsWithPercentage(org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage) Button(javafx.scene.control.Button) Region(javafx.scene.layout.Region) VBox(javafx.scene.layout.VBox) Map(java.util.Map)

Example 75 with GridPane

use of javafx.scene.layout.GridPane in project aic-praise by aic-sri-international.

the class FXUtil method exception.

public static void exception(Throwable th) {
    Dialog<ButtonType> dialog = new Dialog<ButtonType>();
    dialog.setTitle("Program exception");
    final DialogPane dialogPane = dialog.getDialogPane();
    dialogPane.setContentText("Details of the problem:");
    dialogPane.getButtonTypes().addAll(ButtonType.OK);
    dialogPane.setContentText(th.getMessage());
    dialog.initModality(Modality.APPLICATION_MODAL);
    Label label = new Label("Exception stacktrace:");
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    th.printStackTrace(pw);
    pw.close();
    TextArea textArea = new TextArea(sw.toString());
    textArea.setEditable(false);
    textArea.setWrapText(true);
    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);
    GridPane root = new GridPane();
    root.setVisible(false);
    root.setMaxWidth(Double.MAX_VALUE);
    root.add(label, 0, 0);
    root.add(textArea, 0, 1);
    dialogPane.setExpandableContent(root);
    dialog.showAndWait();
}
Also used : DialogPane(javafx.scene.control.DialogPane) GridPane(javafx.scene.layout.GridPane) StringWriter(java.io.StringWriter) TextArea(javafx.scene.control.TextArea) Dialog(javafx.scene.control.Dialog) Label(javafx.scene.control.Label) ButtonType(javafx.scene.control.ButtonType) PrintWriter(java.io.PrintWriter)

Aggregations

GridPane (javafx.scene.layout.GridPane)147 Label (javafx.scene.control.Label)83 Insets (javafx.geometry.Insets)67 Button (javafx.scene.control.Button)46 TextField (javafx.scene.control.TextField)42 VBox (javafx.scene.layout.VBox)37 Scene (javafx.scene.Scene)36 HBox (javafx.scene.layout.HBox)26 ButtonType (javafx.scene.control.ButtonType)25 Text (javafx.scene.text.Text)24 Node (javafx.scene.Node)23 Dialog (javafx.scene.control.Dialog)23 ColumnConstraints (javafx.scene.layout.ColumnConstraints)18 Stage (javafx.stage.Stage)18 TextWithStyle (org.phoenicis.javafx.views.common.TextWithStyle)17 List (java.util.List)16 CheckBox (javafx.scene.control.CheckBox)16 ImageView (javafx.scene.image.ImageView)14 ActionEvent (javafx.event.ActionEvent)13 ComboBox (javafx.scene.control.ComboBox)13