Example usage for javafx.scene.control Label setTextOverrun

List of usage examples for javafx.scene.control Label setTextOverrun

Introduction

In this page you can find the example usage for javafx.scene.control Label setTextOverrun.

Prototype

public final void setTextOverrun(OverrunStyle value) 

Source Link

Usage

From source file:org.sleuthkit.autopsy.timeline.ui.AbstractTimelineChart.java

/**
 * Add a Label Node to the contextual label container for the decluttered
 * axis labels.//from   w  w w. java 2  s.  c om
 *
 * @param labelText  The String to add.
 * @param labelWidth The width, in pixels, of the space to use for the label
 * @param labelX     The horizontal position, in pixels, in the specificPane
 *                   of the text
 */
private synchronized void addContextLabel(String labelText, double labelWidth, double labelX) {
    Label label = new Label(labelText);
    label.setAlignment(Pos.CENTER);
    label.setTextAlignment(TextAlignment.CENTER);
    label.setFont(Font.font(10));
    //use a leading ellipse since that is the lowest frequency part,
    //and can be infered more easily from other surrounding labels
    label.setTextOverrun(OverrunStyle.LEADING_ELLIPSIS);
    //force size
    label.setMinWidth(labelWidth);
    label.setPrefWidth(labelWidth);
    label.setMaxWidth(labelWidth);
    label.relocate(labelX, 0);

    if (labelX == 0) { // first label has no border
        label.setBorder(null);
    } else { // subsequent labels have border on left to create dividers
        label.setBorder(ONLY_LEFT_BORDER);
    }

    contextLabelPane.getChildren().add(label);
}

From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualization.java

/** add a {@link Label} node to the branch container for the decluttered
 * axis labels/*w  ww . j ava  2s.  co m*/
 *
 * @param labelText  the string to add
 * @param labelWidth the width of the space to use for the label
 * @param labelX     the horizontal position in the partPane of the text
 */
private synchronized void assignBranchLabel(String labelText, double labelWidth, double labelX) {

    Label label = new Label(labelText);
    label.setAlignment(Pos.CENTER);
    label.setTextAlignment(TextAlignment.CENTER);
    label.setFont(Font.font(10));
    //use a leading ellipse since that is the lowest frequency part,
    //and can be infered more easily from other surrounding labels
    label.setTextOverrun(OverrunStyle.LEADING_ELLIPSIS);
    //force size
    label.setMinWidth(labelWidth);
    label.setPrefWidth(labelWidth);
    label.setMaxWidth(labelWidth);
    label.relocate(labelX, 0);

    if (labelX == 0) { // first label has no border
        label.setStyle("-fx-border-width: 0 0 0 0 ; -fx-border-color:black;"); // NON-NLS
    } else { // subsequent labels have border on left to create dividers
        label.setStyle("-fx-border-width: 0 0 0 1; -fx-border-color:black;"); // NON-NLS
    }

    branchPane.getChildren().add(label);
}

From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualizationPane.java

/**
 * add a {@link Label} node to the branch container for the decluttered axis
 * labels/* w  w  w . j a v a 2s.co m*/
 *
 * @param labelText  the string to add
 * @param labelWidth the width of the space to use for the label
 * @param labelX     the horizontal position in the partPane of the text
 */
private synchronized void assignBranchLabel(String labelText, double labelWidth, double labelX) {

    Label label = new Label(labelText);
    label.setAlignment(Pos.CENTER);
    label.setTextAlignment(TextAlignment.CENTER);
    label.setFont(Font.font(10));
    //use a leading ellipse since that is the lowest frequency part,
    //and can be infered more easily from other surrounding labels
    label.setTextOverrun(OverrunStyle.LEADING_ELLIPSIS);
    //force size
    label.setMinWidth(labelWidth);
    label.setPrefWidth(labelWidth);
    label.setMaxWidth(labelWidth);
    label.relocate(labelX, 0);

    if (labelX == 0) { // first label has no border
        label.setStyle("-fx-border-width: 0 0 0 0 ; -fx-border-color:black;"); // NON-NLS //NOI18N
    } else { // subsequent labels have border on left to create dividers
        label.setStyle("-fx-border-width: 0 0 0 1; -fx-border-color:black;"); // NON-NLS //NOI18N
    }

    branchPane.getChildren().add(label);
}