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

The following examples show how to use javafx.scene.control.Label#setMaxHeight() . 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: 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 5
Source File: Toast.java    From DevToolBox with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static Toast makeText(String text, boolean wrapText, double maxWidth, double maxHeight, Duration duration) {
    Label label = new Label(text);
    label.getStyleClass().add("text");
    label.setWrapText(wrapText);
    label.setMaxWidth(maxWidth);
    label.setMaxHeight(maxHeight);
    label.setTextFill(DEFAULT_FILL_COLOR);
    return makeToast(label, duration);
}
 
Example 6
Source File: ListTile.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void updateText() {
    textBox.getChildren().clear();
    for (int i = 0; i <= 2; i++) {
        Label label = new Label(textProperty.get(i));
        label.setWrapText(true);
        label.setMaxHeight(Double.MAX_VALUE);
        label.setAlignment(Pos.TOP_LEFT);
        if (i == 0) {
            label.getStyleClass().add("primary");
        }
        textBox.getChildren().add(label);
        VBox.setVgrow(label, Priority.ALWAYS);
    }
}
 
Example 7
Source File: LineNumberGutterFactory.java    From markdown-writer-fx with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public Node apply(int paragraphIndex) {
	int lineNo = paragraphIndex + 1;
	Val<String> text = lineCount.map(n -> {
		int digits = Math.max(3, (int) Math.floor(Math.log10(textArea.getParagraphs().size())) + 1);
		return String.format("%" + digits + "d", lineNo);
	});

	Label label = new Label();
	label.textProperty().bind(text.conditionOnShowing(label));
	label.setAlignment(Pos.TOP_RIGHT);
	label.setMaxHeight(Double.MAX_VALUE);
	label.getStyleClass().add("lineno");
	return label;
}
 
Example 8
Source File: PVTree.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
public Node create()
{
    final Label label = new Label(Messages.PV_Label);
    pv_name.setOnAction(event -> setPVName(pv_name.getText()));
    pv_name.setTooltip(new Tooltip(Messages.PV_TT));

    PVAutocompleteMenu.INSTANCE.attachField(pv_name);

    final ToggleButton latch = new ToggleButton(null, getImageView("run.png"));
    latch.setTooltip(new Tooltip(Messages.LatchTT));
    latch.setOnAction(event ->
    {
        tree.getModel().latchOnAlarm(latch.isSelected());
        if (latch.isSelected())
            latch.setGraphic(getImageView("pause_on_alarm.png"));
        else
            latch.setGraphic(getImageView("run.png"));
    });

    final Button collapse = new Button(null, getImageView("collapse.gif"));
    collapse.setTooltip(new Tooltip(Messages.CollapseTT));
    collapse.setOnAction(event -> tree.expandAll(false));

    final Button alarms = new Button(null, getImageView("alarmtree.png"));
    alarms.setTooltip(new Tooltip(Messages.ExpandAlarmsTT));
    alarms.setOnAction(event -> tree.expandAlarms());

    final Button expand = new Button(null, getImageView("pvtree.png"));
    expand.setTooltip(new Tooltip(Messages.ExpandAllTT));
    expand.setOnAction(event -> tree.expandAll(true));

    // center vertically
    label.setMaxHeight(Double.MAX_VALUE);
    HBox.setHgrow(pv_name, Priority.ALWAYS);
    final HBox top = new HBox(5, label, pv_name, latch, collapse, alarms, expand);
    BorderPane.setMargin(top, new Insets(5, 5, 0, 5));
    BorderPane.setMargin(tree.getNode(), new Insets(5));
    final BorderPane layout = new BorderPane(tree.getNode());
    layout.setTop(top);

    hookDragDrop(layout);

    return layout;
}
 
Example 9
Source File: ProjectImproperResultDialog.java    From arma-dialog-creator with MIT License 4 votes vote down vote up
private Node getLabel(String text) {
	Label label = new Label(text);
	label.setWrapText(true);
	label.setMaxHeight(Double.MAX_VALUE);
	return label;
}
 
Example 10
Source File: TimeIndicator.java    From helloiot with GNU General Public License v3.0 4 votes vote down vote up
public TimeIndicator(String pattern) {
    l = new Label();
    l.setMaxHeight(Double.MAX_VALUE);
    l.getStyleClass().add("currenttime");
    formatter = DateTimeFormatter.ofPattern(pattern);
}