Java Code Examples for javafx.scene.control.Label#setMinHeight()

The following examples show how to use javafx.scene.control.Label#setMinHeight() . 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: TimelinePanel.java    From constellation with Apache License 2.0 6 votes vote down vote up
private Label createExtentLabel() {
    final Label newLabel = new Label();

    // Align the text vertically:
    newLabel.setRotate(270d);
    // Fix the dimensions to prevent jittery motion on value changes:
    newLabel.setMinWidth(150d);
    newLabel.setPrefWidth(150d);
    newLabel.setMaxWidth(150d);
    newLabel.setMinHeight(30d);
    newLabel.setPrefHeight(30d);
    newLabel.setMaxHeight(30d);
    newLabel.setAlignment(Pos.CENTER);

    return newLabel;
}
 
Example 2
Source File: ScriptingAspectEditor.java    From milkman with MIT License 6 votes vote down vote up
private Tab getTab(Supplier<String> getter, Consumer<String> setter, String title) {
	ContentEditor postEditor = new ContentEditor();
	postEditor.setEditable(true);
	postEditor.setContent(getter, setter);
	postEditor.setContentTypePlugins(Collections.singletonList(new JavascriptContentType()));
	postEditor.setContentType("application/javascript");
	postEditor.setHeaderVisibility(false);

	Tab postTab = new Tab("", postEditor);
	Label label = new Label(title);
	label.setRotate(90);
	label.setMinWidth(150);
	label.setMaxWidth(150);
	label.setMinHeight(40);
	label.setMaxHeight(40);
	label.setPadding(new Insets(0));
	postTab.setGraphic(label);
	return postTab;
}
 
Example 3
Source File: OptionsDialog.java    From milkman with MIT License 6 votes vote down vote up
public void showAndWait(List<OptionPageProvider> optionPageProviders) {
	JFXDialogLayout content = new OptionsDialogFxml(this);
	content.setPrefWidth(600);
	for(OptionPageProvider<?> p : optionPageProviders) {
		OptionDialogPane pane = p.getOptionsDialog(new OptionDialogBuilder());
		Tab tab = new Tab("", pane);
		Label label = new Label(pane.getName());
		label.setRotate(90);
		label.setMinWidth(100);
		label.setMaxWidth(100);
		label.setMinHeight(40);
		label.setMaxHeight(40);
		tab.setGraphic(label);
		tabs.getTabs().add(tab);
		
	}

	dialog = FxmlUtil.createDialog(content);
	
	dialog.showAndWait();
}
 
Example 4
Source File: DashboardTile.java    From pdfsam with GNU Affero General Public License v3.0 6 votes vote down vote up
public DashboardTile(String title, String description, Node graphic) {
    getStyleClass().addAll("dashboard-modules-tile");
    Label titleLabel = new Label(title);
    titleLabel.getStyleClass().add("dashboard-modules-tile-title");
    if (nonNull(graphic)) {
        titleLabel.setGraphic(graphic);
    }
    Label textLabel = new Label(description);
    textLabel.getStyleClass().add("dashboard-modules-tile-text");
    textLabel.setMinHeight(USE_PREF_SIZE);
    VBox topTile = new VBox(5);
    topTile.getChildren().addAll(titleLabel, textLabel);

    button.getStyleClass().add("dashboard-modules-invisible-button");
    button.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);

    armed.bind(button.armedProperty());
    getChildren().addAll(new StackPane(topTile, button));
    setMaxHeight(USE_PREF_SIZE);
    setMinHeight(USE_PREF_SIZE);
}
 
Example 5
Source File: SecretEntryView.java    From strongbox with Apache License 2.0 5 votes vote down vote up
private void outputShared() {
    HBox name = KeyValueHBox.createTableRow("Name:", rawSecretEntry.secretIdentifier.name);
    HBox version = KeyValueHBox.createTableRow("Version:", rawSecretEntry.version.toString());

    Label filler = new Label(" ");
    filler.setMinHeight(27);

    HBox state = KeyValueHBox.createTableRow("State:", rawSecretEntry.state.toString());
    HBox notBefore = KeyValueHBox.createTableRow("Not Before:", FormattedTimestamp.toHumanReadable(rawSecretEntry.notBefore));
    HBox notAfter = KeyValueHBox.createTableRow("Not After:", FormattedTimestamp.toHumanReadable(rawSecretEntry.notAfter));

    Label title = new Label("Entry");

    currentSecretView.getChildren().setAll(title, editRow, filler, name, version, state, notBefore, notAfter);
}
 
Example 6
Source File: LayersViewPane.java    From constellation with Apache License 2.0 4 votes vote down vote up
public LayersViewPane(final LayersViewController controller) {

        // create controller
        this.controller = controller;

        // create layer headings
        final Label layerIdHeadingText = new Label("Layer\nID");
        final Label visibilityHeadingText = new Label("Visibility");
        final Label queryHeadingText = new Label("Query");
        final Label descriptionHeadingText = new Label("Description");

        // create gridpane and alignments
        layersGridPane = new GridPane();
        layersGridPane.setHgap(5);
        layersGridPane.setVgap(5);
        layersGridPane.setPadding(new Insets(0, 10, 10, 10));
        layersGridPane.addRow(0, layerIdHeadingText, visibilityHeadingText,
                queryHeadingText, descriptionHeadingText);

        // set heading alignments
        GridPane.setMargin(layerIdHeadingText, new Insets(15, 0, 0, 0));
        layerIdHeadingText.setTextAlignment(TextAlignment.CENTER);
        layerIdHeadingText.setMinWidth(40);
        layerIdHeadingText.setMinHeight(25);
        layerIdHeadingText.setPrefWidth(30);
        visibilityHeadingText.setPrefWidth(55);
        visibilityHeadingText.setMinWidth(50);
        queryHeadingText.setPrefWidth(10000);
        queryHeadingText.setMinWidth(80);
        descriptionHeadingText.setPrefWidth(10000);
        descriptionHeadingText.setMinWidth(80);

        // instantiate list of layers
        layers = new ArrayList<>();

        // set default layers
        setDefaultLayers();

        // create options
        final Button addButton = new Button("Add New Layer");
        addButton.setAlignment(Pos.CENTER_RIGHT);
        addButton.setOnAction(event -> {
            if (layersGridPane.getRowCount() <= 32) {
                createLayer(layers.size() + 1, false, "", "");
                controller.writeState();
            } else {
                final NotifyDescriptor nd = new NotifyDescriptor.Message(
                        "You cannot have more than 32 layers", NotifyDescriptor.WARNING_MESSAGE);
                DialogDisplayer.getDefault().notify(nd);
            }
            event.consume();
        });
        HBox.setHgrow(addButton, Priority.ALWAYS);

        final Button deselectAllButton = new Button("Deselect All Layers");
        deselectAllButton.setAlignment(Pos.CENTER_RIGHT);
        deselectAllButton.setOnAction(event -> {
            for (final LayerDescription layer : layers) {
                layer.setCurrentLayerVisibility(false);
            }
            if (this.layers.isEmpty()) {
                setDefaultLayers();
            } else {
                setLayers(List.copyOf(layers));
            }
            controller.submit();
            controller.execute();

            event.consume();
        });
        HBox.setHgrow(deselectAllButton, Priority.ALWAYS);

        this.options = new HBox(5, addButton, deselectAllButton);
        options.setAlignment(Pos.TOP_LEFT);
        options.setPadding(new Insets(0, 0, 0, 10));

        // add layers grid and options to pane
        this.layersViewPane = new VBox(5, layersGridPane, options);

        // create layout bindings
        layersViewPane.prefWidthProperty().bind(this.widthProperty());
        options.prefWidthProperty().bind(layersViewPane.widthProperty());

        this.setCenter(layersViewPane);
        controller.writeState();
    }
 
Example 7
Source File: FX.java    From FxDock with Apache License 2.0 4 votes vote down vote up
/** creates a label.  accepts: CssStyle, CssID, FxCtl, Insets, OverrunStyle, Pos, TextAlignment, Color, Node, Background */
public static Label label(Object ... attrs)
{
	Label n = new Label();
	
	for(Object a: attrs)
	{
		if(a == null)
		{
			// ignore
		}
		else if(a instanceof CssStyle)
		{
			n.getStyleClass().add(((CssStyle)a).getName());
		}
		else if(a instanceof CssID)
		{
			n.setId(((CssID)a).getID());
		}
		else if(a instanceof FxCtl)
		{
			switch((FxCtl)a)
			{
			case BOLD:
				n.getStyleClass().add(CssTools.BOLD.getName());
				break;
			case FOCUSABLE:
				n.setFocusTraversable(true);
				break;
			case FORCE_MAX_WIDTH:
				n.setMaxWidth(Double.MAX_VALUE);
				break;
			case FORCE_MIN_HEIGHT:
				n.setMinHeight(Control.USE_PREF_SIZE);
				break;
			case FORCE_MIN_WIDTH:
				n.setMinWidth(Control.USE_PREF_SIZE);
				break;
			case NON_FOCUSABLE:
				n.setFocusTraversable(false);
				break;
			case WRAP_TEXT:
				n.setWrapText(true);
				break;
			default:
				throw new Error("?" + a);
			}
		}
		else if(a instanceof Insets)
		{
			n.setPadding((Insets)a);
		}
		else if(a instanceof OverrunStyle)
		{
			n.setTextOverrun((OverrunStyle)a);
		}
		else if(a instanceof Pos)
		{
			n.setAlignment((Pos)a);
		}
		else if(a instanceof String)
		{
			n.setText((String)a);
		}
		else if(a instanceof TextAlignment)
		{
			n.setTextAlignment((TextAlignment)a);
		}
		else if(a instanceof Color)
		{
			n.setTextFill((Color)a);
		}
		else if(a instanceof StringProperty)
		{
			n.textProperty().bind((StringProperty)a);
		}
		else if(a instanceof Node)
		{
			n.setGraphic((Node)a);
		}
		else if(a instanceof Background)
		{
			n.setBackground((Background)a);
		}
		else
		{
			throw new Error("?" + a);
		}			
	}
	
	return n;
}