javafx.scene.layout.Priority Java Examples

The following examples show how to use javafx.scene.layout.Priority. 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: ActivityItemCell.java    From PeerWasp with MIT License 7 votes vote down vote up
private void initializeGrid() {
	grid.setHgap(10);
	grid.setVgap(5);
	grid.setPadding(new Insets(0, 10, 0, 10));

	// icon column
	ColumnConstraints col1 = new ColumnConstraints();
	col1.setFillWidth(false);
	col1.setHgrow(Priority.NEVER);
	grid.getColumnConstraints().add(col1);

	// title column: grows
	ColumnConstraints col2 = new ColumnConstraints();
	col2.setFillWidth(true);
	col2.setHgrow(Priority.ALWAYS);
	grid.getColumnConstraints().add(col2);

	// date column
	ColumnConstraints col3 = new ColumnConstraints();
	col3.setFillWidth(false);
	col3.setHgrow(Priority.NEVER);
	grid.getColumnConstraints().add(col3);
}
 
Example #2
Source File: DaoLaunchWindow.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void createSlideControls() {
    sectionButtonsGroup = new ToggleGroup();

    HBox slideButtons = new HBox();
    slideButtons.setMaxWidth(616);
    slideButtons.getStyleClass().add("dao-launch-tab-box");

    sections.forEach(section -> {
        SectionButton sectionButton = new SectionButton(section.title.toUpperCase(), sections.indexOf(section));
        sectionButton.setMaxWidth(Double.MAX_VALUE);
        HBox.setHgrow(sectionButton, Priority.ALWAYS);
        slideButtons.getChildren().add(sectionButton);
    });

    sectionButtonsGroup.getToggles().get(0).setSelected(true);

    GridPane.setRowIndex(slideButtons, ++rowIndex);
    GridPane.setColumnSpan(slideButtons, 2);
    GridPane.setHalignment(slideButtons, HPos.CENTER);
    GridPane.setHgrow(slideButtons, Priority.NEVER);
    gridPane.getChildren().add(slideButtons);
}
 
Example #3
Source File: SplitDockingContainer.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public SplitDockingContainer(DockingDesktop desktop, IDockingContainer parent, Dockable base, Dockable dockable, Split position,
        double proportion) {
    setMaxHeight(Double.MAX_VALUE);
    setMaxWidth(Double.MAX_VALUE);
    HBox.setHgrow(this, Priority.ALWAYS);
    VBox.setVgrow(this, Priority.ALWAYS);
    getProperties().put(DockingDesktop.DOCKING_CONTAINER, parent);
    setOrientation(position.getOrientation());
    ObservableList<Node> items = getItems();
    if (position == Split.LEFT || position == Split.TOP) {
        items.add(new TabDockingContainer(desktop, this, dockable));
        items.add(new TabDockingContainer(desktop, this, base));
    } else {
        items.add(new TabDockingContainer(desktop, this, base));
        items.add(new TabDockingContainer(desktop, this, dockable));
    }
    setDividerPositions(proportion);
}
 
Example #4
Source File: NotificationBar.java    From yfiton with Apache License 2.0 6 votes vote down vote up
void updatePane() {
    actionsBar = ActionUtils.createButtonBar(getActions());
    actionsBar.opacityProperty().bind(transition);
    GridPane.setHgrow(actionsBar, Priority.SOMETIMES);
    pane.getChildren().clear();

    int row = 0;

    if (title != null) {
        pane.add(title, 0, row++);
    }

    pane.add(label, 0, row);
    pane.add(actionsBar, 1, row);

    if (isCloseButtonVisible()) {
        pane.add(closeBtn, 2, 0, 1, row + 1);
    }
}
 
Example #5
Source File: TransactionTypeNodeProvider.java    From constellation with Apache License 2.0 6 votes vote down vote up
private VBox addFilter() {
    filterText.setPromptText("Filter transaction types");
    final ToggleGroup toggleGroup = new ToggleGroup();
    startsWithRb.setToggleGroup(toggleGroup);
    startsWithRb.setPadding(new Insets(0, 0, 0, 5));
    startsWithRb.setSelected(true);
    final RadioButton containsRadioButton = new RadioButton("Contains");
    containsRadioButton.setToggleGroup(toggleGroup);
    containsRadioButton.setPadding(new Insets(0, 0, 0, 5));

    toggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
        populateTree();
    });

    filterText.textProperty().addListener((observable, oldValue, newValue) -> {
        populateTree();
    });

    final HBox headerBox = new HBox(new Label("Filter: "), filterText, startsWithRb, containsRadioButton);
    headerBox.setAlignment(Pos.CENTER_LEFT);
    headerBox.setPadding(new Insets(5));

    final VBox box = new VBox(schemaLabel, headerBox, treeView);
    VBox.setVgrow(treeView, Priority.ALWAYS);
    return box;
}
 
Example #6
Source File: LoadPane.java    From pattypan with MIT License 6 votes vote down vote up
private void setContent() {
  addElement("validate-intro", 40);

  browsePath.setDisable(true);
  reloadButton.setDisable(true);

  addElementRow(
          new Node[]{browseButton, browsePath, reloadButton},
          new Priority[]{Priority.NEVER, Priority.ALWAYS, Priority.NEVER}
  );
  addElement(new WikiScrollPane(infoContainer));

  prevButton.linkTo("StartPane", stage);
  nextButton.linkTo("CheckPane", stage);
  nextButton.setDisable(true);
}
 
Example #7
Source File: InterruptibleProcessController.java    From chvote-1-0 with GNU Affero General Public License v3.0 6 votes vote down vote up
private void showAlert(ProcessInterruptedException e) {
    Alert alert = new Alert(Alert.AlertType.ERROR);
    ResourceBundle resources = getResourceBundle();
    alert.setTitle(resources.getString("exception_alert.title"));
    alert.setHeaderText(resources.getString("exception_alert.header"));
    alert.setContentText(e.getMessage());

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    e.printStackTrace(pw);
    String exceptionText = sw.toString();

    Label stackTraceLabel = new Label(resources.getString("exception_alert.label"));
    TextArea stackTraceTextArea = new TextArea(exceptionText);
    stackTraceTextArea.setEditable(false);
    stackTraceTextArea.setWrapText(true);
    GridPane.setVgrow(stackTraceTextArea, Priority.ALWAYS);
    GridPane.setHgrow(stackTraceTextArea, Priority.ALWAYS);

    GridPane expandableContent = new GridPane();
    expandableContent.setPrefSize(400, 400);
    expandableContent.setMaxWidth(Double.MAX_VALUE);
    expandableContent.add(stackTraceLabel, 0, 0);
    expandableContent.add(stackTraceTextArea, 0, 1);

    alert.getDialogPane().setExpandableContent(expandableContent);
    // Dirty Linux only fix...
    // Expandable zones cause the dialog not to resize correctly
    if (System.getProperty("os.name").matches(".*[Ll]inux.*")) {
        alert.getDialogPane().setPrefSize(600, 400);
        alert.setResizable(true);
        alert.getDialogPane().setExpanded(true);
    }

    alert.showAndWait();
}
 
Example #8
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple3<Label, TextField, Button> addTopLabelTextFieldButton(GridPane gridPane,
                                                                          int rowIndex,
                                                                          String title,
                                                                          String buttonTitle,
                                                                          double top) {

    TextField textField = new BisqTextField();
    textField.setEditable(false);
    textField.setMouseTransparent(true);
    textField.setFocusTraversable(false);
    Button button = new AutoTooltipButton(buttonTitle);
    button.setDefaultButton(true);

    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(textField, button);
    HBox.setHgrow(textField, Priority.ALWAYS);

    final Tuple2<Label, VBox> labelVBoxTuple2 = addTopLabelWithVBox(gridPane, rowIndex, title, hBox, top);

    return new Tuple3<>(labelVBoxTuple2.first, textField, button);
}
 
Example #9
Source File: NotificationBar.java    From oim-fx with MIT License 6 votes vote down vote up
void updatePane() {
    actionsBar = ActionUtils.createButtonBar(getActions());
    actionsBar.opacityProperty().bind(transition);
    GridPane.setHgrow(actionsBar, Priority.SOMETIMES);
    pane.getChildren().clear();
    
    int row = 0;
    
    if (title != null) {
        pane.add(title, 0, row++);
    }
    
    pane.add(label, 0, row);
    pane.add(actionsBar, 1, row);
    
    if (isCloseButtonVisible()) {
        pane.add(closeBtn, 2, 0, 1, row+1);
    }
}
 
Example #10
Source File: EasyGridPane.java    From constellation with Apache License 2.0 6 votes vote down vote up
public void addColumnConstraint(boolean fillWidth, HPos alignment, Priority grow, double maxWidth, double minWidth, double prefWidth, double percentWidth) {
    ColumnConstraints constraint = new ColumnConstraints();
    constraint.setFillWidth(fillWidth);
    constraint.setHalignment(alignment);
    constraint.setHgrow(grow);
    constraint.setMaxWidth(maxWidth);
    constraint.setMinWidth(minWidth);
    constraint.setPrefWidth(prefWidth);

    if (percentWidth >= 0) {
        constraint.setPercentWidth(percentWidth);
    }

    getColumnConstraints().add(constraint);
}
 
Example #11
Source File: AddPreferenceStage.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public Parent getContentPane() {
    VBox content = new VBox();
    content.getStyleClass().add("add-preference-stage");
    content.setId("addPreferenceStage");
    FormPane form = new FormPane("add-preference-stage-form", 3);
    integerValueField.textProperty().addListener(new ChangeListener<String>() {
        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            if (!newValue.matches("\\d*")) {
                integerValueField.setText(newValue.replaceAll("[^\\d]", ""));
            }
        }
    });
    StackPane pane = new StackPane(stringValueField, integerValueField, booleanValueField);
    pane.setAlignment(Pos.CENTER_LEFT);
    //@formatter:off
    form.addFormField("Property name:", nameField)
        .addFormField("Method:", typeComboBox, new Region())
        .addFormField("Value:", pane);
    //@formatter:on
    GridPane.setHgrow(typeComboBox, Priority.NEVER);
    VBox.setVgrow(form, Priority.ALWAYS);
    content.getChildren().addAll(form, buttonBar);
    return content;
}
 
Example #12
Source File: FixtureSelection.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
private void initComponents() {
    VBox.setVgrow(fixtureList, Priority.ALWAYS);
    fixtureList.setId("fixture-list-view");
    fixtureList.setItems(fixtuers);
    fixtureList.setOnMouseClicked((e) -> {
        if (e.getClickCount() == 2)
            onSelect(fixtureList.getSelectionModel().getSelectedItem());
    });
    fixtureList.getSelectionModel().select(selectedFixture);
    fixtureList.getSelectionModel().selectedIndexProperty().addListener((listener) -> {
        updateButtonState();
    });

    selectButton.setOnAction((e) -> onSelect(fixtureList.getSelectionModel().getSelectedItem()));
    cancelButton.setOnAction((e) -> onCancel());
    buttonBar.getButtons().addAll(selectButton, cancelButton);
    buttonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
    updateButtonState();
}
 
Example #13
Source File: EditAxis.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
private Pane getRangeChangeButtons(final Axis axis, final boolean isHorizontal) {
    final Button incMaxButton = new Button("", new Glyph(EditAxis.FONT_AWESOME, "expand"));
    incMaxButton.setMaxWidth(Double.MAX_VALUE);
    VBox.setVgrow(incMaxButton, Priority.NEVER);
    HBox.setHgrow(incMaxButton, Priority.NEVER);
    incMaxButton.setOnAction(evt -> {
        axis.setAutoRanging(false);
        changeAxisRange(axis, true);
    });

    final Button decMaxButton = new Button("", new Glyph(EditAxis.FONT_AWESOME, "compress"));
    decMaxButton.setMaxWidth(Double.MAX_VALUE);
    VBox.setVgrow(decMaxButton, Priority.NEVER);
    HBox.setHgrow(decMaxButton, Priority.NEVER);

    decMaxButton.setOnAction(evt -> {
        axis.setAutoRanging(false);
        changeAxisRange(axis, false);
    });
    final Pane boxMax = isHorizontal ? new VBox() : new HBox();
    boxMax.getChildren().addAll(incMaxButton, decMaxButton);

    return boxMax;
}
 
Example #14
Source File: ProposalsView.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void createProposalsTableView() {
    proposalsHeadline = new TableGroupHeadline(Res.get("dao.proposal.active.header"));
    GridPane.setRowIndex(proposalsHeadline, ++gridRow);
    GridPane.setMargin(proposalsHeadline, new Insets(Layout.GROUP_DISTANCE, -10, -10, -10));
    root.getChildren().add(proposalsHeadline);

    tableView = new TableView<>();
    tableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    createProposalColumns();
    GridPane.setRowIndex(tableView, gridRow);
    GridPane.setHgrow(tableView, Priority.ALWAYS);
    GridPane.setVgrow(tableView, Priority.SOMETIMES);
    GridPane.setMargin(tableView, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, -10, 5, -10));
    root.getChildren().add(tableView);

    tableView.setItems(sortedList);
}
 
Example #15
Source File: DotHTMLLabelJavaFxNode.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
private void applyTableAlignAttributesOnTdPane(GridPane wrapper) {
	/*
	 * Graphviz documentation specifies for the ALIGN attribute on cells: If
	 * the cell does not contain text, then the contained image or table is
	 * centered.
	 *
	 * Further, by observation, unless the fixedsize attribute is set, in
	 * graphviz the inner table grows in both horizontal and vertical
	 * direction.
	 *
	 * TODO: revise these settings when the align attribute on table tags is
	 * implemented, as this may change some behaviour.
	 */
	GridPane.setHgrow(wrapper.getChildren().get(0), Priority.ALWAYS);
	GridPane.setVgrow(wrapper.getChildren().get(0), Priority.ALWAYS);
	wrapper.setAlignment(Pos.CENTER);
}
 
Example #16
Source File: Deck.java    From logbook-kai with MIT License 6 votes vote down vote up
@Override
protected void updateItem(DeckFleetPane item, boolean empty) {
    super.updateItem(item, empty);
    if (!empty) {
        if (item != null) {
            Label text = new Label();
            text.textProperty().bind(item.getFleetName().textProperty());
            Pane pane = new Pane();
            Button del = new Button("除去");
            del.getStyleClass().add("delete");
            del.setOnAction(e -> {
                Deck.this.fleetList.getItems().remove(item);
                Deck.this.fleets.getChildren().removeIf(node -> node == item);
            });
            HBox box = new HBox(text, pane, del);
            HBox.setHgrow(pane, Priority.ALWAYS);

            this.setGraphic(box);
        } else {
            this.setGraphic(null);
        }
    } else {
        this.setGraphic(null);
    }
}
 
Example #17
Source File: SpreadView.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void initialize() {
    tableView = new TableView<>();

    int gridRow = 0;
    GridPane.setRowIndex(tableView, gridRow);
    GridPane.setVgrow(tableView, Priority.ALWAYS);
    GridPane.setHgrow(tableView, Priority.ALWAYS);
    root.getChildren().add(tableView);
    Label placeholder = new AutoTooltipLabel(Res.get("table.placeholder.noData"));
    placeholder.setWrapText(true);
    tableView.setPlaceholder(placeholder);

    TableColumn<SpreadItem, SpreadItem> currencyColumn = getCurrencyColumn();
    tableView.getColumns().add(currencyColumn);
    numberOfOffersColumn = getNumberOfOffersColumn();
    tableView.getColumns().add(numberOfOffersColumn);
    numberOfBuyOffersColumn = getNumberOfBuyOffersColumn();
    tableView.getColumns().add(numberOfBuyOffersColumn);
    numberOfSellOffersColumn = getNumberOfSellOffersColumn();
    tableView.getColumns().add(numberOfSellOffersColumn);
    totalAmountColumn = getTotalAmountColumn();
    tableView.getColumns().add(totalAmountColumn);
    TableColumn<SpreadItem, SpreadItem> spreadColumn = getSpreadColumn();
    tableView.getColumns().add(spreadColumn);
    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    currencyColumn.setComparator(Comparator.comparing(o -> CurrencyUtil.getNameByCode(o.currencyCode)));
    numberOfOffersColumn.setComparator(Comparator.comparingInt(o3 -> o3.numberOfOffers));
    numberOfBuyOffersColumn.setComparator(Comparator.comparingInt(o3 -> o3.numberOfBuyOffers));
    numberOfSellOffersColumn.setComparator(Comparator.comparingInt(o2 -> o2.numberOfSellOffers));
    totalAmountColumn.setComparator(Comparator.comparing(o -> o.totalAmount));
    spreadColumn.setComparator(Comparator.comparingDouble(o -> o.percentageValue));

    numberOfOffersColumn.setSortType(TableColumn.SortType.DESCENDING);
    tableView.getSortOrder().add(numberOfOffersColumn);
    itemListChangeListener = c -> updateHeaders();
}
 
Example #18
Source File: SettingNumberField.java    From MSPaintIDE with MIT License 6 votes vote down vote up
public SettingNumberField() {
    getStyleClass().add("theme-text");
    setStyle("-fx-padding: 10px 0");
    label.getStyleClass().add("theme-text");
    numberField.getStyleClass().add("theme-text");


    Node spacer = getHSpacer(10);
    HBox.setHgrow(label, Priority.NEVER);
    HBox.setHgrow(numberField, Priority.NEVER);
    HBox.setHgrow(spacer, Priority.NEVER);

    label.setPrefHeight(25);
    getChildren().add(label);
    getChildren().add(spacer);
    getChildren().add(numberField);
    numberField.textProperty().addListener(((observable, oldValue, newValue) -> SettingsManager.getInstance().setSetting(settingProperty.get(), newValue.isEmpty() ? 0 : Integer.valueOf(newValue))));
}
 
Example #19
Source File: RestRequestEditController.java    From milkman with MIT License 6 votes vote down vote up
public RestRequestEditControllerFxml(RestRequestEditController controller) {
	HBox.setHgrow(this, Priority.ALWAYS);
	var methods = new JFXComboBox<String>();
	add(methods);
	methods.setId("httpMethods");
	controller.httpMethod = methods;
	methods.setValue("GET");
	methods.getItems().add("GET");
	methods.getItems().add("POST");
	methods.getItems().add("PUT");
	methods.getItems().add("DELETE");
	methods.getItems().add("PATCH");
	methods.getItems().add("HEAD");
	methods.getItems().add("OPTIONS");
	
	controller.requestUrl = add(new LongTextField(), true);
	controller.requestUrl.setId("requestUrl");
}
 
Example #20
Source File: FilterFileCell.java    From VocabHunter with Apache License 2.0 6 votes vote down vote up
public FilterFileCell(final I18nManager i18nManager, final Consumer<FilterFileModel> removalHandler, final Consumer<FilterFileModel> editHandler) {
    this.i18nManager = i18nManager;

    HBox.setHgrow(spacer, Priority.ALWAYS);
    hbox.setAlignment(Pos.CENTER_LEFT);
    iconBox.setAlignment(Pos.CENTER_LEFT);
    iconBox.getStyleClass().add("iconBox");

    buttonEdit.setOnAction(e -> editHandler.accept(lastItem));
    buttonEdit.setId("buttonEdit");
    buttonEdit.setTooltip(new Tooltip(i18nManager.text(FILTER_MAIN_LISTS_BUTTON_EDIT)));
    editIcon.setStyleClass("buttonEditIcon");

    buttonRemoveList.setOnAction(e -> removalHandler.accept(lastItem));
    buttonRemoveList.setTooltip(new Tooltip(i18nManager.text(FILTER_MAIN_LISTS_BUTTON_DELETE)));
    removeListIcon.setStyleClass("buttonDeleteIcon");
}
 
Example #21
Source File: ManageWorkspacesDialog.java    From milkman with MIT License 6 votes vote down vote up
private HBox createEntry(String workspaceName) {
	
	JFXButton renameButton = new JFXButton();
	renameButton.setGraphic(new FontAwesomeIconView(FontAwesomeIcon.PENCIL, "1.5em"));
	renameButton.setTooltip(new Tooltip("Rename workspace"));
	renameButton.setOnAction(e -> triggerRenameDialog(workspaceName));
	
	JFXButton deleteButton = new JFXButton();
	deleteButton.setGraphic(new FontAwesomeIconView(FontAwesomeIcon.TIMES, "1.5em"));
	deleteButton.setTooltip(new Tooltip("Delete workspace"));
	deleteButton.setOnAction(e -> {
		onCommand.invoke(new AppCommand.DeleteWorkspace(workspaceName));
		Platform.runLater(() -> workspaces.remove(workspaceName));
	});

	JFXButton exportButton = new JFXButton();
	exportButton.setGraphic(new FontAwesomeIconView(FontAwesomeIcon.UPLOAD, "1.5em"));
	exportButton.setTooltip(new Tooltip("Export workspace"));
	exportButton.setOnAction(e -> triggerExportWorkspaceDialog(workspaceName));

	Label wsName = new Label(workspaceName);
	HBox.setHgrow(wsName, Priority.ALWAYS);
	
	return new HBox(wsName, renameButton, deleteButton, exportButton);
}
 
Example #22
Source File: StatusPanel.java    From Quelea with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Create a new status panel.
 * <p/>
 * @param group the group this panel is part of.
 * @param labelText the text to put on the label on this panel.
 * @param index the index of this panel on the group.
 */
StatusPanel(StatusPanelGroup group, String labelText, int index) {
    setAlignment(Pos.CENTER);
    setSpacing(5);
    this.group = group;
    this.index = index;
    label = new Label(labelText);
    label.setAlignment(Pos.CENTER);
    label.setMaxHeight(Double.MAX_VALUE);
    HBox.setMargin(label, new Insets(5));
    progressBar = new ProgressBar();
    progressBar.setMaxWidth(Double.MAX_VALUE); //Allow progress bar to fill space.
    HBox.setHgrow(progressBar, Priority.ALWAYS);
    cancelButton = new Button("", new ImageView(new Image("file:icons/cross.png", 13, 13, false, true)));
    Utils.setToolbarButtonStyle(cancelButton);
    cancelButton.setAlignment(Pos.CENTER);
    getChildren().add(label);
    getChildren().add(progressBar);
    getChildren().add(cancelButton);
}
 
Example #23
Source File: TilingPane.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
public TilingPane(final Layout layout, Node... nodes) {
    super();
    this.layout.set(layout);
    VBox.setVgrow(this, Priority.ALWAYS);
    getChildren().addListener((ListChangeListener<Node>) change -> {
        while (change.next()) {
            layoutNormal();
        }
    });

    this.layout.addListener((ch, o, n) -> layoutNormal());

    if (nodes != null) {
        getChildren().addAll(nodes);
    }
}
 
Example #24
Source File: EditAxis.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
private Pane getMinMaxButtons(final Axis axis, final boolean isHorizontal, final boolean isMin) {
    final Button incMaxButton = new Button("", new Glyph(EditAxis.FONT_AWESOME, "\uf077"));
    incMaxButton.setMaxWidth(Double.MAX_VALUE);
    VBox.setVgrow(incMaxButton, Priority.ALWAYS);
    HBox.setHgrow(incMaxButton, Priority.ALWAYS);
    incMaxButton.setOnAction(evt -> {
        axis.setAutoRanging(false);
        changeAxisRangeLimit(axis, isHorizontal ? isMin : !isMin, true);
    });

    final Button decMaxButton = new Button("", new Glyph(EditAxis.FONT_AWESOME, "\uf078"));
    decMaxButton.setMaxWidth(Double.MAX_VALUE);
    VBox.setVgrow(decMaxButton, Priority.ALWAYS);
    HBox.setHgrow(decMaxButton, Priority.ALWAYS);

    decMaxButton.setOnAction(evt -> {
        axis.setAutoRanging(false);
        changeAxisRangeLimit(axis, isHorizontal ? isMin : !isMin, false);
    });
    final Pane box = isHorizontal ? new VBox() : new HBox();
    box.getChildren().addAll(incMaxButton, decMaxButton);

    return box;
}
 
Example #25
Source File: DialogPlus.java    From ApkToolPlus with Apache License 2.0 5 votes vote down vote up
/**
 *  显示Exception的Dialog
 *
 * @param ex  异常
 */
public static void exception(Exception ex){
    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle("Exception Dialog");
    alert.setHeaderText("Look, an Exception Dialog");
    alert.setContentText("Could not find file blabla.txt!");

    //Exception ex = new FileNotFoundException("Could not find file blabla.txt");

    // Create expandable Exception.
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    ex.printStackTrace(pw);
    String exceptionText = sw.toString();

    Label label = new Label("The exception stacktrace was:");

    TextArea textArea = new TextArea(exceptionText);
    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 expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    // Set expandable Exception into the dialog pane.
    alert.getDialogPane().setExpandableContent(expContent);
    alert.showAndWait();
}
 
Example #26
Source File: ExtractModule.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
private VBox settingPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);
    VBox.setVgrow(selectionPane, Priority.ALWAYS);

    TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
            prefix);
    prefix.addMenuItemFor(Prefix.FILENUMBER);
    prefix.addMenuItemFor("[TOTAL_FILESNUMBER]");

    pane.getChildren().addAll(selectionPane,
            titledPane(DefaultI18nContext.getInstance().i18n("Extract settings"), extractOptions),
            titledPane(DefaultI18nContext.getInstance().i18n("Output settings"), destinationPane), prefixTitled);
    return pane;
}
 
Example #27
Source File: Story.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/** @return the content of the address, with a signature and portrait attached. */
private Pane getContent() {
  final VBox content = new VBox();
  content.getStyleClass().add("address");

  //int rand = RandomUtil.getRandomInt(1);

  final Label address = new Label(START1+START2+MID1+MID2+MID3+MID4);

  address.setWrapText(true);
  ScrollPane addressScroll = makeScrollable(address);

  final ImageView signature = new ImageView(); signature.setId("signature");
  final ImageView lincolnImage = new ImageView(); lincolnImage.setId("portrait");
  VBox.setVgrow(addressScroll, Priority.ALWAYS);

  final Region spring = new Region();
  HBox.setHgrow(spring, Priority.ALWAYS);
  
  //final Node alignedSignature = HBoxBuilder.create().children(spring, signature).build();
  final HBox alignedSignature = new HBox(spring, signature);
  
  Label date = new Label(DATE);
  date.setAlignment(Pos.BOTTOM_RIGHT);

  content.getChildren().addAll(
      lincolnImage,
      addressScroll,
      alignedSignature,
      date
  );

  return content;
}
 
Example #28
Source File: Sample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
/**
 * Create a resizable sample
 */
public Sample() {
    isFixedSize = false;
    VBox.setVgrow(this, Priority.ALWAYS);
    setMaxWidth(Double.MAX_VALUE);
    setMaxHeight(Double.MAX_VALUE);
}
 
Example #29
Source File: AlertMaker.java    From Library-Assistant with Apache License 2.0 5 votes vote down vote up
public static void showErrorMessage(Exception ex) {
    Alert alert = new Alert(AlertType.ERROR);
    alert.setTitle("Error occured");
    alert.setHeaderText("Error Occured");
    alert.setContentText(ex.getLocalizedMessage());

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    ex.printStackTrace(pw);
    String exceptionText = sw.toString();

    Label label = new Label("The exception stacktrace was:");

    TextArea textArea = new TextArea(exceptionText);
    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 expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    alert.getDialogPane().setExpandableContent(expContent);

    styleAlert(alert);
    alert.showAndWait();
}
 
Example #30
Source File: RollingBufferSample.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
private HBox getHeaderBar(Scene scene) {
    final Button newDataSet = new Button("new DataSet");
    newDataSet.setOnAction(evt -> {
        getTask(0).run();
        getTask(1).run();
    });

    final Button startTimer = new Button("timer");
    startTimer.setOnAction(evt -> {
        if (timer == null) {
            timer = new Timer[2];
            timer[0] = new Timer("sample-update-timer", true);
            rollingBufferBeamIntensity.reset();
            timer[0].scheduleAtFixedRate(getTask(0), 0, UPDATE_PERIOD);

            timer[1] = new Timer("sample-update-timer", true);
            rollingBufferDipoleCurrent.reset();
            timer[1].scheduleAtFixedRate(getTask(1), 0, UPDATE_PERIOD);
        } else {
            timer[0].cancel();
            timer[1].cancel();
            timer = null; // NOPMD
        }
    });

    // H-Spacer
    Region spacer = new Region();
    spacer.setMinWidth(Region.USE_PREF_SIZE);
    HBox.setHgrow(spacer, Priority.ALWAYS);

    final ProfilerInfoBox profilerInfoBox = new ProfilerInfoBox(DEBUG_UPDATE_RATE);
    profilerInfoBox.setDebugLevel(DebugLevel.VERSION);

    return new HBox(newDataSet, startTimer, spacer, profilerInfoBox);
}