Java Code Examples for javafx.scene.control.ToggleButton#setTooltip()

The following examples show how to use javafx.scene.control.ToggleButton#setTooltip() . 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: DisplayEditor.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
private ToggleButton createToggleButton(final ActionDescription action)
{
    final ToggleButton button = new ToggleButton();
    try
    {
        button.setGraphic(ImageCache.getImageView(action.getIconResourcePath()));
    }
    catch (final Exception ex)
    {
        logger.log(Level.WARNING, "Cannot load action icon", ex);
    }
    button.setTooltip(new Tooltip(action.getToolTip()));
    button.setSelected(true);
    button.selectedProperty()
          .addListener((observable, old_value, enabled) -> action.run(this, enabled) );
    return button;
}
 
Example 2
Source File: SceneFileEditor.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
@Override
@FxThread
protected void createToolbar(@NotNull final HBox container) {
    super.createToolbar(container);

    lightButton = new ToggleButton();
    lightButton.setTooltip(new Tooltip(Messages.SCENE_FILE_EDITOR_ACTION_SHOW_LIGHTS));
    lightButton.setGraphic(new ImageView(Icons.LIGHT_16));
    lightButton.setSelected(true);
    lightButton.selectedProperty().addListener((observable, oldValue, newValue) -> changeLight(newValue));

    audioButton = new ToggleButton();
    audioButton.setTooltip(new Tooltip(Messages.SCENE_FILE_EDITOR_ACTION_SHOW_AUDIO));
    audioButton.setGraphic(new ImageView(Icons.AUDIO_16));
    audioButton.setSelected(true);
    audioButton.selectedProperty().addListener((observable, oldValue, newValue) -> changeAudio(newValue));

    DynamicIconSupport.addSupport(lightButton, audioButton);

    FXUtils.addClassesTo(lightButton, audioButton, CssClasses.FILE_EDITOR_TOOLBAR_BUTTON);

    FXUtils.addToPane(lightButton, container);
    FXUtils.addToPane(audioButton, container);
}
 
Example 3
Source File: RichTextDemo.java    From RichTextFX with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private ToggleButton createToggleButton(ToggleGroup grp, String styleClass, Runnable action, String toolTip) {
    ToggleButton button = new ToggleButton();
    button.setToggleGroup(grp);
    button.getStyleClass().add(styleClass);
    button.setOnAction(evt -> {
        action.run();
        area.requestFocus();
    });
    button.setPrefWidth(25);
    button.setPrefHeight(25);
    if (toolTip != null) {
        button.setTooltip(new Tooltip(toolTip));
    }
    return button;
}
 
Example 4
Source File: PVTree.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
public Node create()
{
    final Label label = new Label(Messages.PV_Label);
    pv_name.setOnAction(event -> setPVName(pv_name.getText()));
    pv_name.setTooltip(new Tooltip(Messages.PV_TT));

    PVAutocompleteMenu.INSTANCE.attachField(pv_name);

    final ToggleButton latch = new ToggleButton(null, getImageView("run.png"));
    latch.setTooltip(new Tooltip(Messages.LatchTT));
    latch.setOnAction(event ->
    {
        tree.getModel().latchOnAlarm(latch.isSelected());
        if (latch.isSelected())
            latch.setGraphic(getImageView("pause_on_alarm.png"));
        else
            latch.setGraphic(getImageView("run.png"));
    });

    final Button collapse = new Button(null, getImageView("collapse.gif"));
    collapse.setTooltip(new Tooltip(Messages.CollapseTT));
    collapse.setOnAction(event -> tree.expandAll(false));

    final Button alarms = new Button(null, getImageView("alarmtree.png"));
    alarms.setTooltip(new Tooltip(Messages.ExpandAlarmsTT));
    alarms.setOnAction(event -> tree.expandAlarms());

    final Button expand = new Button(null, getImageView("pvtree.png"));
    expand.setTooltip(new Tooltip(Messages.ExpandAllTT));
    expand.setOnAction(event -> tree.expandAll(true));

    // center vertically
    label.setMaxHeight(Double.MAX_VALUE);
    HBox.setHgrow(pv_name, Priority.ALWAYS);
    final HBox top = new HBox(5, label, pv_name, latch, collapse, alarms, expand);
    BorderPane.setMargin(top, new Insets(5, 5, 0, 5));
    BorderPane.setMargin(tree.getNode(), new Insets(5));
    final BorderPane layout = new BorderPane(tree.getNode());
    layout.setTop(top);

    hookDragDrop(layout);

    return layout;
}