Java Code Examples for javafx.scene.control.Label

The following examples show how to use javafx.scene.control.Label. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: dev-tools   Source File: HttpHeadersTextField.java    License: Apache License 2.0 6 votes vote down vote up
private void populatePopup(List<String> searchResult) {
    List<CustomMenuItem> menuItems = new LinkedList<>();
    int count = Math.min(searchResult.size(), maxEntries);
    for (int i = 0; i < count; i++) {
        final String result = searchResult.get(i);
        Label entryLabel = new Label(result);
        CustomMenuItem item = new CustomMenuItem(entryLabel, true);
        item.setOnAction(actionEvent -> {
            setText(result);
            entriesPopup.hide();
        });
        menuItems.add(item);
    }
    entriesPopup.getItems().clear();
    entriesPopup.getItems().addAll(menuItems);
}
 
Example 2
private void buildAndShowMainWindow(Stage primaryStage) {
    primaryStage.setTitle("Hello World!!");
    GridPane gridPane = new GridPane();
    gridPane.setAlignment(Pos.CENTER);
    gridPane.setHgap(10);
    gridPane.setVgap(10);
    gridPane.setPadding(new Insets(25, 25, 25, 25));

    button = new Button("Click me!");
    gridPane.add(button,1,1);

    text = new TextField();
    gridPane.add(text, 2, 1);

    clockLabel = new Label();
    gridPane.add(clockLabel, 1,2, 2, 1);

    Scene scene = new Scene(gridPane);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
Example 3
private void initView() {
    ObservableList<String> options = FXCollections.observableArrayList();
    for (DisplayMode mode : DisplayMode.values()) {
        options.add(mode.name);
    }
    registerModeBox.setItems(options);
    registerModeBox.setOnAction(event ->
            setDisplayMode(DisplayMode.values()[registerModeBox.getSelectionModel().getSelectedIndex()]));
    registerModeBox.getSelectionModel().select(0);
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 4; j++) {
            int index = j * 8 + i;
            RegisterType registerType = getType(index);
            registerLable[index] = new Label("");
            registerLable[index].setFont(Font.font("Consolas", 16));
            registerLable[index].setTextFill(registerType.getColor());
            registerPane.add(registerLable[index], j, i);
        }
    }
    updateAllRegisters();
}
 
Example 4
Source Project: mzmine3   Source File: FontSpecsComponent.java    License: GNU General Public License v2.0 6 votes vote down vote up
public FontSpecsComponent() {

    fontLabel = new Label();

    fontSelectButton = new Button("Select font");
    fontSelectButton.setOnAction(e -> {
      var dialog = new FontSelectorDialog(currentFont);
      var result = dialog.showAndWait();
      if (result.isPresent())
        setFont(result.get());
    });

    colorPicker = new ColorPicker(Color.BLACK);

    getChildren().addAll(fontLabel, fontSelectButton, colorPicker);
  }
 
Example 5
Source Project: xframium-java   Source File: DatasetTable.java    License: GNU General Public License v3.0 6 votes vote down vote up
public DatasetTable ()
{
  addColumnString ("Dataset name", 300, Justification.LEFT, "datasetName");
  addColumnString ("Volume", 70, Justification.LEFT, "volume");
  addColumnNumber ("Tracks", 50, "tracks");
  addColumnNumber ("% used", 50, "percentUsed");
  addColumnNumber ("XT", 50, "extents");
  addColumnString ("Device", 50, Justification.CENTER, "device");
  addColumnString ("Dsorg", 50, Justification.LEFT, "dsorg");
  addColumnString ("Recfm", 50, Justification.LEFT, "recfm");
  addColumnNumber ("Lrecl", 50, "lrecl");
  addColumnNumber ("Blksize", 70, "blksize");
  addColumnString ("Created", 100, Justification.CENTER, "created");
  addColumnString ("Expires", 100, Justification.CENTER, "expires");
  addColumnString ("Referred", 100, Justification.CENTER, "referred");
  addColumnString ("Catalog", 150, Justification.LEFT, "catalog");

  setPlaceholder (new Label ("No datasets have been seen in this session"));

  setItems (datasets);
}
 
Example 6
Source Project: constellation   Source File: TableVisualisation.java    License: Apache License 2.0 6 votes vote down vote up
public TableVisualisation(final AbstractTableTranslator<? extends AnalyticResult<?>, C> translator) {
    this.translator = translator;

    this.tableVisualisation = new VBox();

    this.tableFilter = new TextField();
    tableFilter.setPromptText("Type here to filter results");

    this.table = new TableView<>();
    table.setPlaceholder(new Label("No results"));
    table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    table.setId("table-visualisation");
    table.setPadding(new Insets(5));

    tableVisualisation.getChildren().addAll(tableFilter, table);
}
 
Example 7
Source Project: logbook-kai   Source File: Deck.java    License: MIT License 6 votes vote down vote up
@Override
protected void updateItem(DeckFleetPane item, boolean empty) {
    super.updateItem(item, empty);
    if (!empty) {
        if (item != null) {
            Label text = new Label();
            text.textProperty().bind(item.getFleetName().textProperty());
            Pane pane = new Pane();
            Button del = new Button("除去");
            del.getStyleClass().add("delete");
            del.setOnAction(e -> {
                Deck.this.fleetList.getItems().remove(item);
                Deck.this.fleets.getChildren().removeIf(node -> node == item);
            });
            HBox box = new HBox(text, pane, del);
            HBox.setHgrow(pane, Priority.ALWAYS);

            this.setGraphic(box);
        } else {
            this.setGraphic(null);
        }
    } else {
        this.setGraphic(null);
    }
}
 
Example 8
Source Project: Recaf   Source File: UpdateWindow.java    License: MIT License 6 votes vote down vote up
/**
 * @param window
 * 		Window reference to handle UI access.
 *
 * @return Update popup.
 */
public static UpdateWindow create(MainWindow window) {
	Label lblTitle = new Label(translate("update.outdated"));
	Label lblVersion = new Label(Recaf.VERSION + " → " + SelfUpdater.getLatestVersion());
	Label lblDate = new Label(SelfUpdater.getLatestVersionDate().toString());
	lblTitle.getStyleClass().add("h1");
	lblDate.getStyleClass().add("faint");
	GridPane grid = new GridPane();
	GridPane.setHalignment(lblVersion, HPos.CENTER);
	GridPane.setHalignment(lblDate, HPos.CENTER);
	grid.setPadding(new Insets(15));
	grid.setHgap(10);
	grid.setVgap(10);
	grid.setAlignment(Pos.CENTER);
	grid.add(new Label(translate("update.available")), 0, 0);
	grid.add(new ActionButton(translate("misc.open"), () -> window.getMenubar().showUpdatePrompt()), 1, 0);
	grid.add(lblVersion, 0, 1, 2, 1);
	grid.add(lblDate, 0, 2, 2, 1);
	return new UpdateWindow(grid, lblTitle);
}
 
Example 9
Source Project: Vert.X-generator   Source File: SetUnitTestController.java    License: MIT License 6 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
	tblProperty.setEditable(true);
	tblProperty.setStyle("-fx-font-size:14px");
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_TBL_TIPS);
	String title = property == null ? "可以在右边自定义添加属性..." : property.get();
	tblProperty.setPlaceholder(new Label(title));
	tblPropertyValues = FXCollections.observableArrayList();
	// 设置列的大小自适应
	tblProperty.setColumnResizePolicy(resize -> {
		double width = resize.getTable().getWidth();
		tdKey.setPrefWidth(width / 3);
		tdValue.setPrefWidth(width / 3);
		tdDescribe.setPrefWidth(width / 3);
		return true;
	});
	btnConfirm.widthProperty().addListener(w -> {
		double x = btnConfirm.getLayoutX() + btnConfirm.getWidth() + 10;
		btnCancel.setLayoutX(x);
	});
}
 
Example 10
Source Project: SmartCity-ParkingManagement   Source File: PmMap.java    License: Apache License 2.0 6 votes vote down vote up
protected Marker createMarker(final LatLong lat, final String title) {
	final MarkerOptions options = new MarkerOptions();
	options.position(lat).title(title).visible(true);
	final Marker $ = new MyMarker(options, title, lat);
	markers.add($);
	fromLocation.getItems().add(title);
	toLocation.getItems().add(title);
	final HBox hbox = new HBox();
	hbox.setPadding(new Insets(8, 5, 8, 5));
	hbox.setSpacing(8);
	final Label l = new Label(title);
	final Button btn = new Button("remove");
	btn.setOnAction(λ -> {
		map.removeMarker($);
		markerVbox.getChildren().remove(hbox);
		fromLocation.getItems().remove(title);
		toLocation.getItems().remove(title);
	});
	btns.add(btn);
	hbox.getChildren().addAll(l, btn);
	VBox.setMargin(hbox, new Insets(0, 0, 0, 8));
	markerVbox.getChildren().add(hbox);
	return $;

}
 
Example 11
Source Project: marathonv5   Source File: AddPropertiesView.java    License: Apache License 2.0 6 votes vote down vote up
public AddPropertiesView(TestPropertiesInfo issueInfo) {
    this.issueInfo = issueInfo;
    initComponents();
 // @formatter:off
    Label severityLabel = new Label("Severity: ");
    severityLabel.setMinWidth(Region.USE_PREF_SIZE);
    tmsLink.setOnAction((e) -> {
        try {
            Desktop.getDesktop().browse(new URI(tmsLink.getText()));
        } catch (Exception e1) {
            FXUIUtils._showMessageDialog(null, "Unable to open link: " + tmsLink.getText(), "Unable to open link",
                    AlertType.ERROR);
            e1.printStackTrace();
        }
    });
    formPane.addFormField("Name: ", nameField)
            .addFormField("Description: ", descriptionField)
            .addFormField("ID: ", idField, severityLabel, severities);
    String tmsPattern = System.getProperty(Constants.PROP_TMS_PATTERN);
    if (tmsPattern != null && tmsPattern.length() > 0) {
        tmsLink.textProperty().bind(Bindings.format(tmsPattern, idField.textProperty()));
        formPane.addFormField("", tmsLink);
    }
    // @formatter:on
    setCenter(content);
}
 
Example 12
Source Project: SONDY   Source File: GlobalUI.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void about(){
    final Stage stage = new Stage();
    stage.setResizable(false);
    stage.initModality(Modality.WINDOW_MODAL);
    stage.initStyle(StageStyle.UTILITY);
    stage.setTitle("About SONDY");
    WebView webView = new WebView();
    webView.getEngine().loadContent(getReferences());
    webView.setMaxWidth(Main.columnWidthLEFT);
    webView.setMinWidth(Main.columnWidthLEFT);
    webView.setMaxHeight(Main.columnWidthLEFT);
    webView.setMinHeight(Main.columnWidthLEFT);
    Scene scene = new Scene(VBoxBuilder.create().children(new Label("SONDY "+Main.version),new Label("Main developper: Adrien Guille <[email protected]>"),webView).alignment(Pos.CENTER).padding(new Insets(10)).spacing(3).build());
    scene.getStylesheets().add("resources/fr/ericlab/sondy/css/GlobalStyle.css");
    stage.setScene(scene);
    stage.show();
}
 
Example 13
Source Project: chart-fx   Source File: DataSetMeasurements.java    License: Apache License 2.0 6 votes vote down vote up
protected void addGraphBelowItems() {
    final String toolTip = "whether to draw the new DataSet below (checked) or above (un-checked) the existing DataSets";
    final Label label = new Label("draw below: ");
    label.setTooltip(new Tooltip(toolTip));
    GridPane.setConstraints(label, 0, lastLayoutRow);
    graphBelowOtherDataSets.setSelected(false);
    graphBelowOtherDataSets.setTooltip(new Tooltip(toolTip));
    GridPane.setConstraints(graphBelowOtherDataSets, 1, lastLayoutRow++);

    graphBelowOtherDataSets.selectedProperty().addListener((obs, o, n) -> {
        final Chart chart = localChart.get();
        if (chart == null) {
            return;
        }
        chart.getRenderers().remove(renderer);
        if (Boolean.TRUE.equals(n)) {
            chart.getRenderers().add(0, renderer);
        } else {
            chart.getRenderers().add(renderer);
        }
    });

    this.getDialogContentBox().getChildren().addAll(label, graphBelowOtherDataSets);
}
 
Example 14
Source Project: Path-of-Leveling   Source File: SocketGroupListCell.java    License: MIT License 6 votes vote down vote up
@Override
protected void updateItem(SocketGroup sg, boolean empty) {
    super.updateItem(sg, empty) ;
    if (empty) {
        setText(null);
    } else {
        Label l = new Label();
        if(sg.getActiveGem()!=null){
            if(!sg.getActiveGem().getGemName().equals("<empty group>")){
                l.setGraphic(new ImageView(sg.getActiveGem().getSmallIcon()));
                l.setText(sg.getActiveGem().getGemName());
            }
        }
        else{
            setText(null);
        }
        setGraphic(l);

    }
}
 
Example 15
Source Project: pmd-designer   Source File: ASTTreeCell.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
private ContextMenu buildContextMenu(Node item) {
    ContextMenu contextMenu = new ContextMenuWithNoArrows();
    CustomMenuItem menuItem = new CustomMenuItem(new Label("Export subtree...",
                                                           new FontIcon("fas-external-link-alt")));

    Tooltip tooltip = new Tooltip("Export subtree to a text format");
    Tooltip.install(menuItem.getContent(), tooltip);

    menuItem.setOnAction(
        e -> getService(DesignerRoot.TREE_EXPORT_WIZARD).apply(x -> x.showYourself(x.bindToNode(item)))
    );

    contextMenu.getItems().add(menuItem);

    return contextMenu;
}
 
Example 16
Source Project: tilesfx   Source File: CalendarTileSkin.java    License: Apache License 2.0 5 votes vote down vote up
@Override protected void initGraphics() {
    super.initGraphics();

    final ZonedDateTime TIME = tile.getTime();

    titleText = new Text(MONTH_YEAR_FORMATTER.format(TIME));
    titleText.setFill(tile.getTitleColor());

    clickHandler = e -> checkClick(e);

    labels = new ArrayList<>(56);
    for (int i = 0 ; i < 56 ; i++) {
        Label label = new Label();
        label.setManaged(false);
        label.setVisible(false);
        label.setAlignment(Pos.CENTER);
        label.addEventHandler(MouseEvent.MOUSE_PRESSED, clickHandler);
        labels.add(label);
    }

    weekBorder = new Border(new BorderStroke(Color.TRANSPARENT,
                                             Tile.GRAY,
                                             Color.TRANSPARENT,
                                             Color.TRANSPARENT,
                                             BorderStrokeStyle.NONE,
                                             BorderStrokeStyle.SOLID,
                                             BorderStrokeStyle.NONE,
                                             BorderStrokeStyle.NONE,
                                             CornerRadii.EMPTY, BorderWidths.DEFAULT,
                                             Insets.EMPTY));

    text = new Text(DAY_FORMATTER.format(TIME));
    text.setFill(tile.getTextColor());

    getPane().getChildren().addAll(titleText, text);
    getPane().getChildren().addAll(labels);
}
 
Example 17
Source Project: bisq   Source File: FormBuilder.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
public static Label addMultilineLabel(GridPane gridPane, int rowIndex, String text, double top, double maxWidth) {
    Label label = new AutoTooltipLabel(text);
    label.setWrapText(true);
    label.setMaxWidth(maxWidth);
    GridPane.setHalignment(label, HPos.LEFT);
    GridPane.setHgrow(label, Priority.ALWAYS);
    GridPane.setRowIndex(label, rowIndex);
    GridPane.setMargin(label, new Insets(top + Layout.FLOATING_LABEL_DISTANCE, 0, 0, 0));
    gridPane.getChildren().add(label);
    return label;
}
 
Example 18
Source Project: phoebus   Source File: SpinnerDemo.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void start(final Stage stage)
{
    final Label label = new Label("Demo:");

    SpinnerValueFactory<Double> svf = new SpinnerValueFactory.DoubleSpinnerValueFactory(0, 1000);
    Spinner<Double> spinner = new Spinner<>();
    spinner.setValueFactory(svf);
    spinner.editorProperty().getValue().setStyle("-fx-text-fill:" + "black");
    spinner.editorProperty().getValue().setBackground(
            new Background(new BackgroundFill(Color.AZURE, CornerRadii.EMPTY, Insets.EMPTY)));


    //spinner.getStyleClass().add(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL);
    //int x = spinner.getStyleClass().indexOf(Spinner.STYLE_CLASS_ARROWS_ON_LEFT_VERTICAL);
    //if (x > 0) spinner.getStyleClass().remove(x);

    spinner.setEditable(true);
    spinner.setPrefWidth(80);

    spinner.valueProperty().addListener((prop, old, value) ->
    {
        System.out.println("Value: " + value);
    });

    final HBox root = new HBox(label, spinner);

    final Scene scene = new Scene(root, 800, 700);
    stage.setScene(scene);
    stage.setTitle("Spinner Demo");

    stage.show();
}
 
Example 19
@Override
@FxThread
protected void createComponents() {
    super.createComponents();

    resourceLabel = new Label(NOT_SELECTED);

    var changeButton = new Button();
    changeButton.setGraphic(new ImageView(Icons.ADD_16));
    changeButton.setOnAction(event -> chooseNew());

    var removeButton = new Button();
    removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
    removeButton.setOnAction(event -> removeCurrent());
    removeButton.disableProperty()
            .bind(resourceLabel.textProperty().isEqualTo(NOT_SELECTED));

    var container = new HBox(resourceLabel, changeButton, removeButton);
    container.prefWidthProperty()
            .bind(widthProperty().multiply(DEFAULT_FIELD_W_PERCENT));

    resourceLabel.prefWidthProperty()
            .bind(container.widthProperty());

    FxUtils.addChild(this, container);

    FxUtils.addClass(container,
                    CssClasses.DEF_HBOX, CssClasses.TEXT_INPUT_CONTAINER)
            .addClass(changeButton, removeButton,
                    CssClasses.FLAT_BUTTON, CssClasses.INPUT_CONTROL_TOOLBAR_BUTTON)
            .addClass(resourceLabel,
                    CssClasses.ABSTRACT_PARAM_CONTROL_ELEMENT_LABEL);

    DynamicIconSupport.addSupport(changeButton);
}
 
Example 20
Source Project: tcMenu   Source File: UIFloatMenuItem.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected int internalInitPanel(GridPane grid, int idx) {
    idx++;
    grid.add(new Label("Decimal Places"), 0, idx);
    decimalPlaces = new TextField(String.valueOf(getMenuItem().getNumDecimalPlaces()));
    decimalPlaces.textProperty().addListener(this::coreValueChanged);
    decimalPlaces.setId("decimalPlacesField");
    TextFormatterUtils.applyIntegerFormatToField(decimalPlaces);
    grid.add(decimalPlaces, 1, idx);
    return idx;
}
 
Example 21
Source Project: samples   Source File: HelloFX.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void start(Stage stage) {
    String javaVersion = System.getProperty("java.version");
    String javafxVersion = System.getProperty("javafx.version");
    Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
    Scene scene = new Scene(new StackPane(l), 640, 480);
    stage.setScene(scene);
    stage.show();
}
 
Example 22
Source Project: OEE-Designer   Source File: TimeTileSkin.java    License: MIT License 5 votes vote down vote up
@Override protected void initGraphics() {
    super.initGraphics();

    titleText = new Text();
    titleText.setFill(tile.getTitleColor());
    Helper.enableNode(titleText, !tile.getTitle().isEmpty());

    text = new Text(tile.getText());
    text.setFill(tile.getUnitColor());
    Helper.enableNode(text, tile.isTextVisible());

    LocalTime duration = tile.getDuration();

    leftText = new Text(Integer.toString(duration.getHour() > 0 ? duration.getHour() : duration.getMinute()));
    leftText.setFill(tile.getValueColor());
    leftUnit = new Text(duration.getHour() > 0 ? "h" : "m");
    leftUnit.setFill(tile.getValueColor());

    rightText = new Text(Integer.toString(duration.getHour() > 0 ? duration.getMinute() : duration.getSecond()));
    rightText.setFill(tile.getValueColor());
    rightUnit = new Text(duration.getHour() > 0 ? "m" : "s");
    rightUnit.setFill(tile.getValueColor());

    timeText = new TextFlow(leftText, leftUnit, rightText, rightUnit);
    timeText.setTextAlignment(TextAlignment.RIGHT);
    timeText.setPrefWidth(PREFERRED_WIDTH * 0.9);

    description = new Label(tile.getDescription());
    description.setAlignment(Pos.TOP_RIGHT);
    description.setWrapText(true);
    description.setTextFill(tile.getTextColor());
    Helper.enableNode(description, !tile.getDescription().isEmpty());

    getPane().getChildren().addAll(titleText, text, timeText, description);
}
 
Example 23
public FileObjectView() throws IOException {

        Label lbName = new Label();
        CheckBox cbSubscribed = new CheckBox("Subscribed?");

        GridPane gridPane = new GridPane();
        gridPane.addRow(0, new Label("Name:"), lbName);
        gridPane.addRow(1, cbSubscribed);

        setCenter(gridPane);

        // create a FileClient to the specified file
        FileClient fileClient = FileClient.create(new File(ROOT_DIR, "user.json"));

        // create a JSON converter that converts a JSON object into a user object
        InputStreamInputConverter<User> converter = new JsonInputConverter<>(User.class);

        // retrieve an object from an ObjectDataReader created from the FileClient
        GluonObservableObject<User> user = DataProvider.retrieveObject(fileClient.createObjectDataReader(converter));

        // when the object is initialized, bind its properties to the JavaFX UI controls
        user.initializedProperty().addListener((obs, oldValue, newValue) -> {
            if (newValue) {
                lbName.textProperty().bind(user.get().nameProperty());
                cbSubscribed.selectedProperty().bindBidirectional(user.get().subscribedProperty());
            }
        });

        // write user to file when selected property of the subscribed checkbox is changed
        cbSubscribed.selectedProperty().addListener((obs, ov, nv) -> {
            user.get().setSubscribed(nv);

            // create a JSON converter that converts the user object into a JSON object
            OutputStreamOutputConverter<User> outputConverter = new JsonOutputConverter<>(User.class);

            // store an object with an ObjectDataWriter created from the FileClient
            DataProvider.storeObject(user.get(), fileClient.createObjectDataWriter(outputConverter));
        });
    }
 
Example 24
Source Project: Cryogen   Source File: RefreshThread.java    License: GNU General Public License v2.0 5 votes vote down vote up
public RefreshThread(
        ImageView ImgA, ImageView ImgB, ImageView ImgC, 
        Label NameA, Label NameB, Label NameC, 
        ProgressIndicator ProgA, ProgressIndicator ProgB, ProgressIndicator ProgC
) {
    this.ImgA = ImgA;
    this.ImgB = ImgB;
    this.ImgC = ImgC;
    this.NameA = NameA;
    this.NameB = NameB;
    this.NameC = NameC;
    this.ProgA = ProgA;
    this.ProgB = ProgB;
    this.ProgC = ProgC;
}
 
Example 25
Source Project: chart-fx   Source File: WaterfallPerformanceSample.java    License: Apache License 2.0 5 votes vote down vote up
private ToolBar getTestToolBar(final Scene scene) {
    ToolBar testVariableToolBar = new ToolBar();
    final Button fillDataSet = new Button("fill");
    fillDataSet.setTooltip(new Tooltip("update data set with demo data"));
    fillDataSet.setOnAction(evt -> dataSet.fillTestData());

    final Button stepDataSet = new Button("step");
    stepDataSet.setTooltip(new Tooltip("update data set by one row"));
    stepDataSet.setOnAction(evt -> dataSet.step());

    // repetitively generate new data
    final Button periodicTimer = new Button("timer");
    periodicTimer.setTooltip(new Tooltip("update data set periodically"));
    periodicTimer.setOnAction(evt -> updateTimer(false));

    updatePeriod.valueProperty().addListener((ch, o, n) -> updateTimer(true));
    updatePeriod.setEditable(true);
    updatePeriod.setPrefWidth(80);

    final ProfilerInfoBox profilerInfoBox = new ProfilerInfoBox(DEBUG_UPDATE_RATE);
    profilerInfoBox.setDebugLevel(DebugLevel.VERSION);

    final Pane spacer = new Pane();
    HBox.setHgrow(spacer, Priority.ALWAYS);
    testVariableToolBar.getItems().addAll(fillDataSet, stepDataSet, periodicTimer, updatePeriod, new Label("[ms]"), spacer, profilerInfoBox);
    return testVariableToolBar;
}
 
Example 26
Source Project: phoebus   Source File: AlarmTableUI.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/** Limit the number of alarms
 *  @param alarms List of alarms, may be trimmed
 *  @param alarm_count Label where count will be shown
 *  @param message Message to use for the count
 */
private void limitAlarmCount(final List<AlarmInfoRow> alarms,
                             final Label alarm_count, final String message)
{
    final int N = alarms.size();
    final StringBuilder buf = new StringBuilder();
    buf.append(message).append(N);
    if (N > AlarmSystem.alarm_table_max_rows)
    {
        buf.append(" (").append(N - AlarmSystem.alarm_table_max_rows).append(" not shown)");
        alarms.subList(AlarmSystem.alarm_table_max_rows, N).clear();
    }
    alarm_count.setText(buf.toString());
}
 
Example 27
Source Project: mars-sim   Source File: MultiplayerTray.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the GUI
 * @return the main window application content.
 */
private Node createContent() {
    Label hello = new Label("Mars Simulation Project\nMultiplayer Client Connector");
    hello.setStyle("-fx-font-size: 15px; -fx-text-fill: forestgreen;");
    Label instructions = new Label("(click to hide)");
    instructions.setStyle("-fx-font-size: 12px; -fx-text-fill: orange;");

    VBox content = new VBox(10, hello, instructions);
    content.setAlignment(Pos.CENTER);

    return content;
}
 
Example 28
private Label getAssigneeLabelWithAvatar() {
    Label assignee = new Label(getLoginName());
    assignee.setGraphic(getAvatarImageView());
    FontLoader fontLoader = Toolkit.getToolkit().getFontLoader();
    double width = fontLoader.computeStringWidth(assignee.getText(), assignee.getFont());
    assignee.setPrefWidth(width + 35 + AVATAR_SIZE);
    assignee.setPrefHeight(LABEL_HEIGHT);
    assignee.getStyleClass().add("labels");
    assignee.setStyle("-fx-background-color: lightgreen;");
    return assignee;
}
 
Example 29
public BasicObjectView() {

        Label lbName = new Label();
        CheckBox cbSubscribed = new CheckBox("Subscribed?");

        GridPane gridPane = new GridPane();
        gridPane.addRow(0, new Label("Name:"), lbName);
        gridPane.addRow(1, cbSubscribed);

        setCenter(gridPane);

        // create a DataSource that loads data from a classpath resource
        InputDataSource dataSource = new BasicInputDataSource(Main.class.getResourceAsStream("/user.json"));

        // create a Converter that converts a json object into a java object
        InputStreamInputConverter<User> converter = new JsonInputConverter<>(User.class);

        // create an ObjectDataReader that will read the data from the DataSource and converts
        // it from json into an object
        ObjectDataReader<User> objectDataReader = new InputStreamObjectDataReader<>(dataSource, converter);

        // retrieve an object from the DataProvider
        GluonObservableObject<User> user = DataProvider.retrieveObject(objectDataReader);

        // when the object is initialized, bind its properties to the JavaFX UI controls
        user.initializedProperty().addListener((obs, oldValue, newValue) -> {
            if (newValue) {
                lbName.textProperty().bind(user.get().nameProperty());
                cbSubscribed.selectedProperty().bindBidirectional(user.get().subscribedProperty());
            }
        });
    }
 
Example 30
Source Project: marathonv5   Source File: StatusBar.java    License: Apache License 2.0 5 votes vote down vote up
private Label createLabel(String text) {
    Label label = new Label(text);
    label.setMinWidth(Region.USE_PREF_SIZE);
    label.setPadding(new Insets(3, 15, 3, 3));
    label.setAlignment(Pos.CENTER);
    return label;
}