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

The following examples show how to use javafx.scene.control.Label#getText() . 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: CalendarTileSkin.java    From OEE-Designer with MIT License 6 votes vote down vote up
private void checkClick(final MouseEvent EVENT) {
    Label  selectedLabel = ((Label) EVENT.getSource());
    String selectedText  = selectedLabel.getText();
    if (null == selectedText ||
        selectedText.isEmpty() ||
        !Character.isDigit(selectedText.charAt(0))) { return; }
    if (selectedLabel.getBorder() != null && selectedLabel.getBorder().equals(weekBorder)) { return; }
    int selectedNo = Integer.parseInt(selectedText);
    if (selectedNo > 31) { return; }

    List<ChartData>     dataList          = tile.getChartData();
    ZonedDateTime       time              = tile.getTime();
    LocalDate           selectedDate      = LocalDate.of(time.getYear(), time.getMonth(), selectedNo);
    Optional<ChartData> selectedChartData = dataList.stream().filter(data -> data.getTimestampAsLocalDate().isEqual(selectedDate)).findAny();

    if (selectedChartData.isPresent()) { tile.fireTileEvent(new TileEvent(EventType.SELECTED_CHART_DATA, selectedChartData.get())); }
}
 
Example 2
Source File: CalendarTileSkin.java    From tilesfx with Apache License 2.0 6 votes vote down vote up
private void checkClick(final MouseEvent EVENT) {
    Label  selectedLabel = ((Label) EVENT.getSource());
    String selectedText  = selectedLabel.getText();
    if (null == selectedText ||
        selectedText.isEmpty() ||
        !Character.isDigit(selectedText.charAt(0))) { return; }
    if (selectedLabel.getBorder() != null && selectedLabel.getBorder().equals(weekBorder)) { return; }
    int selectedNo = Integer.parseInt(selectedText);
    if (selectedNo > 31) { return; }

    List<ChartData>     dataList          = tile.getChartData();
    ZonedDateTime       time              = tile.getTime();
    LocalDate           selectedDate      = LocalDate.of(time.getYear(), time.getMonth(), selectedNo);
    Optional<ChartData> selectedChartData = dataList.stream().filter(data -> data.getTimestampAsLocalDate().isEqual(selectedDate)).findAny();

    if (selectedChartData.isPresent()) { tile.fireTileEvent(new TileEvent(EventType.SELECTED_CHART_DATA, selectedChartData.get())); }
}
 
Example 3
Source File: JavaFXElementPropertyAccessor.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
protected String _getLabeledBy() {
    Parent root = node.getScene().getRoot();
    Set<Node> allLabels = root.lookupAll(".label");
    for (Node node2 : allLabels) {
        Label label = (Label) node2;
        if (label.getLabelFor() == node) {
            return label.getText();
        }
    }
    return null;
}
 
Example 4
Source File: ReadLayoutPaneSearcher.java    From megan-ce with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getCurrentLabel() {
    if (isCurrentSet()) {
        Label label = labels.get(currentIndex);
        if (label.getTooltip() != null)
            return label.getTooltip().getText();
        else
            return label.getText();
    } else
        return "";
}
 
Example 5
Source File: MyTab.java    From AsciidocFX with Apache License 2.0 5 votes vote down vote up
public String getTabText() {
    Label label = getLabel();
    return label.getText();
}