Example usage for javafx.scene.control Label relocate

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

Introduction

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

Prototype

public void relocate(double x, double y) 

Source Link

Document

Sets the node's layoutX and layoutY translation properties in order to relocate this node to the x,y location in the parent.

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   ww w  .  j  a va2s .com
 *
 * @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//from w w  w . j a v a 2 s  .  c o  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/*from   w w w  .j  ava2  s  .  c om*/
 *
 * @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);
}