Example usage for javafx.scene.control Label setBorder

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

Introduction

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

Prototype

public final void setBorder(Border 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.// www.  jav a 2 s. c  o  m
 *
 * @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);
}