Java Code Examples for javafx.scene.control.Button#setMnemonicParsing()

The following examples show how to use javafx.scene.control.Button#setMnemonicParsing() . 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: MainNode.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
public void setToolbarButton(EventHandler<ActionEvent> backevent, Node graphic, String text) {
    
    Label l = new Label();
    l.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
    l.setAlignment(Pos.CENTER);
    l.setGraphic(graphic);
    l.setPrefSize(45.0, 40.0);             
    
    backbutton = new Button(text, l);     
    backbutton.setAlignment(Pos.BASELINE_LEFT);
    backbutton.setMaxWidth(Double.MAX_VALUE);
    backbutton.setFocusTraversable(false);
    backbutton.setMnemonicParsing(false);
    backbutton.getStyleClass().add("menubutton");
    backbutton.setOnAction(backevent);
    backbutton.setVisible(backevent != null);
}
 
Example 2
Source File: EditEvent.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Node constructContent() {
    HBox hboxroot = new HBox();
    hboxroot.setSpacing(6.0);
    
    payload = new TextField();
    payload.getStyleClass().add("unitinput");
    HBox.setHgrow(payload, Priority.SOMETIMES);
    ((TextField)payload).setOnAction(this::onEnterEvent);
    
    fireaction = new Button();
    fireaction.setFocusTraversable(false);
    fireaction.setMnemonicParsing(false);
    fireaction.getStyleClass().add("unitbutton");
    fireaction.setOnAction(this::onSendEvent);
    
    hboxroot.getChildren().addAll(payload, fireaction);
    
    initialize();
    return hboxroot;
}
 
Example 3
Source File: ControlIntensity.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Node constructContent() {
    VBox vboxroot = new VBox();
    vboxroot.setSpacing(10.0);
    
    action = new Button();
    action.setContentDisplay(ContentDisplay.TOP);
    action.setFocusTraversable(false);
    action.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    action.setMnemonicParsing(false);
    action.getStyleClass().add("buttonbase");
    VBox.setVgrow(action, Priority.SOMETIMES);
    action.setOnAction(this::onAction);
    
    slider = new Slider();
    slider.setFocusTraversable(false);
    slider.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    slider.setPrefWidth(20.0);
    
    vboxroot.getChildren().addAll(action, slider);
    
    initialize();
    return vboxroot;
}
 
Example 4
Source File: EditAreaEvent.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Node constructContent() {
    HBox hboxroot = new HBox();
    hboxroot.setSpacing(6.0);
    
    payload = new TextArea();
    payload.getStyleClass().add("unitinputarea");
    payload.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    payload.setPrefHeight(100.0);
    HBox.setHgrow(payload, Priority.SOMETIMES);

    
    fireaction = new Button();
    fireaction.setFocusTraversable(false);
    fireaction.setMnemonicParsing(false);
    fireaction.getStyleClass().add("unitbutton");
    fireaction.setOnAction(this::onSendEvent);
    
    hboxroot.getChildren().addAll(payload, fireaction);
    
    initialize();
    return hboxroot;    
}
 
Example 5
Source File: BoolButtonRepresentation.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public ButtonBase createJFXNode() throws Exception
{
    led = new Ellipse();
    led.getStyleClass().add("led");
    button = new Button("BoolButton", led);
    button.getStyleClass().add("action_button");
    button.setMnemonicParsing(false);

    // Model has width/height, but JFX widget has min, pref, max size.
    // updateChanges() will set the 'pref' size, so make min use that as well.
    button.setMinSize(ButtonBase.USE_PREF_SIZE, ButtonBase.USE_PREF_SIZE);

    // Fix initial layout
    toolkit.execute(() -> Platform.runLater(button::requestLayout));

    if (! toolkit.isEditMode())
    {
        if (model_widget.propMode().getValue() == Mode.TOGGLE)
            button.setOnAction(event -> handlePress(true));
        else
        {
            final boolean inverted = model_widget.propMode().getValue() == Mode.PUSH_INVERTED;
            button.setOnMousePressed(event -> handlePress(! inverted));
            button.setOnMouseReleased(event -> handlePress(inverted));
        }
    }

    return button;
}
 
Example 6
Source File: MainNode.java    From helloiot with GNU General Public License v3.0 4 votes vote down vote up
public void construct(List<UnitPage> appunitpages) {
    
    appunitpage.subscribeStatus(messagePageHandler);
    appbeeper.subscribeStatus(beeper.getMessageHandler());
    appbuzzer.subscribeStatus(buzzer.getMessageHandler());
    systime.subscribeStatus(timeindicator.getMessageHandler());

    // Add configured unitpages.
    for (UnitPage up : appunitpages) {
        this.addUnitPage(up);
    }

    //Init unit nodes
    for (Unit u : app.getUnits()) {
        Node n = u.getNode();
        if (n != null) {
            UnitPage unitpage = buildUnitPage(UnitPage.getPage(n));
            unitpage.addUnitNode(n);
        }
    }

    // Build listpages based on unitpages
    List<UnitPage> sortedunitpages = new ArrayList<>();
    sortedunitpages.addAll(unitpages.values());
    Collections.sort(sortedunitpages);
    firstmenupage = null;
    for (UnitPage value : sortedunitpages) {
        value.buildNode();
        if (!value.isSystem() && !value.isEmpty() && (value.getName() == null || !value.getName().startsWith("."))) {
            Label l = new Label();
            l.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
            l.setAlignment(Pos.CENTER);
            l.setGraphic(value.getGraphic());
            l.setPrefSize(45.0, 40.0);                
            Button buttonmenu = new Button(value.getText(), l);
            buttonmenu.getStyleClass().add("menubutton");
            buttonmenu.setAlignment(Pos.BASELINE_LEFT);
            buttonmenu.setMaxWidth(Double.MAX_VALUE);
            buttonmenu.setFocusTraversable(false);
            buttonmenu.setMnemonicParsing(false);
            buttonmenu.setOnAction(e -> {
                appunitpage.sendStatus(value.getName());              
            });
            menupages.getChildren().add(buttonmenu); // Last button is disconnect button
            if (firstmenupage == null) {
                firstmenupage = value.getName();
            }
        }
    }
    
    // Add backbutton
    if (backbutton != null && backbutton.isVisible()) {
        menupages.getChildren().add(new Separator(Orientation.HORIZONTAL));
        menupages.getChildren().add(backbutton);
    }
    
    gotoPage("start");

    // Remove menubutton if 0 or 1 visible page.
    menubutton.setVisible(!menupages.getChildren().isEmpty());
}
 
Example 7
Source File: ButtonsSpinner.java    From helloiot with GNU General Public License v3.0 4 votes vote down vote up
@Override
    public Node constructContent() {
        
        VBox vboxroot = new VBox();
        vboxroot.setSpacing(10.0);        
        
        boxview = new HBox();
        boxview.setSpacing(6.0);
        
        level = new Label();
        level.setAlignment(Pos.CENTER_RIGHT);
        level.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
        level.getStyleClass().add("unitmaintext");
        HBox.setHgrow(level, Priority.SOMETIMES);
        
        boxview.getChildren().add(level);
        
        HBox hbox = new HBox();
        hbox.setSpacing(6.0);
        hbox.setAlignment(Pos.BOTTOM_CENTER);
//        StackPane.setAlignment(hbox, Pos.BOTTOM_CENTER);
        
        godown = new Button();
        godown.setFocusTraversable(false);
        godown.setMnemonicParsing(false);
        godown.getStyleClass().add("buttonbase");
        godown.setOnAction(this::onGoDown);
        
        goup = new Button();
        goup.setFocusTraversable(false);
        goup.setMnemonicParsing(false);
        goup.getStyleClass().add("buttonbase");
        goup.setOnAction(this::onGoUp);
        
        hbox.getChildren().addAll(godown, goup);
        
        StackPane stack = new StackPane(hbox);     
        VBox.setVgrow(stack, Priority.SOMETIMES);
        
        vboxroot.getChildren().addAll(boxview, stack);
        
        initialize();
        return vboxroot;
    }
 
Example 8
Source File: EditStatus.java    From helloiot with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Node constructContent() {
    
    StackPane stackpaneroot = new StackPane();
    
    boxview = new HBox();
    boxview.setSpacing(6.0);
    
    statusview = new TextField();
    statusview.setEditable(false);
    statusview.setFocusTraversable(false);
    statusview.getStyleClass().add("unitinputview");
    HBox.setHgrow(statusview, Priority.SOMETIMES);
    
    editaction = new Button();
    editaction.setFocusTraversable(false);
    editaction.setMnemonicParsing(false);
    editaction.getStyleClass().add("unitbutton");
    editaction.setOnAction(this::onEditEvent);
    
    boxview.getChildren().addAll(statusview, editaction);
    
    boxedit = new HBox();
    boxedit.setSpacing(6.0);
    boxedit.setVisible(false);
    
    statusedit = new TextField();
    statusedit.getStyleClass().add("unitinput");
    HBox.setHgrow(statusedit, Priority.SOMETIMES);
    ((TextField) statusedit).setOnAction(this::onEnterEvent);
    
    okaction = new Button();
    okaction.setFocusTraversable(false);
    okaction.setMnemonicParsing(false);
    okaction.getStyleClass().add("unitbutton");
    okaction.setOnAction(this::onOkEvent);
    
    cancelaction = new Button();
    cancelaction.setFocusTraversable(false);
    cancelaction.setMnemonicParsing(false);
    cancelaction.getStyleClass().add("unitbutton");
    cancelaction.setOnAction(this::onCancelEvent);
    
    boxedit.getChildren().addAll(statusedit, okaction, cancelaction);
    
    stackpaneroot.getChildren().addAll(boxview, boxedit);

    initialize();
    return stackpaneroot;
}
 
Example 9
Source File: EditAreaStatus.java    From helloiot with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Node constructContent() {
    StackPane stackpaneroot = new StackPane();
    
    boxview = new HBox();
    boxview.setSpacing(6.0);
    
    statusview = new TextArea();
    statusview.setEditable(false);
    statusview.setFocusTraversable(false);
    statusview.setMaxSize(Double.MAX_VALUE,Double.MAX_VALUE);
    statusview.setPrefHeight(100.0);
    statusview.getStyleClass().add("unitinputview");
    HBox.setHgrow(statusview, Priority.SOMETIMES);
    
    editaction = new Button();
    editaction.setFocusTraversable(false);
    editaction.setMnemonicParsing(false);
    editaction.getStyleClass().add("unitbutton");
    editaction.setOnAction(this::onEditEvent);
    
    boxview.getChildren().addAll(statusview, editaction);
    
    boxedit = new HBox();
    boxedit.setSpacing(6.0);
    boxedit.setVisible(false);
    
    statusedit = new TextArea();
    statusedit.setMaxSize(Double.MAX_VALUE,Double.MAX_VALUE);
    statusedit.setPrefHeight(100.0);        
    statusedit.getStyleClass().add("unitinputarea");
    HBox.setHgrow(statusedit, Priority.SOMETIMES);
    
    okaction = new Button();
    okaction.setFocusTraversable(false);
    okaction.setMnemonicParsing(false);
    okaction.getStyleClass().add("unitbutton");
    okaction.setOnAction(this::onOkEvent);
    
    cancelaction = new Button();
    cancelaction.setFocusTraversable(false);
    cancelaction.setMnemonicParsing(false);
    cancelaction.getStyleClass().add("unitbutton");
    cancelaction.setOnAction(this::onCancelEvent);
    
    boxedit.getChildren().addAll(statusedit, okaction, cancelaction);
    
    stackpaneroot.getChildren().addAll(boxview, boxedit);

    initialize();
    return stackpaneroot;
}