Java Code Examples for javafx.scene.control.Button#setFocusTraversable()
The following examples show how to use
javafx.scene.control.Button#setFocusTraversable() .
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 |
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 |
@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: StringEditor.java From old-mzmine3 with GNU General Public License v2.0 | 6 votes |
public StringEditor(PropertySheet.Item parameter) { if (!(parameter instanceof StringParameter)) throw new IllegalArgumentException(); this.stringParameter = (StringParameter) parameter; // The text field this.textField = new TextField(); setCenter(textField); // The Add button EventHandler<ActionEvent> autoSetAction = stringParameter.getAutoSetAction(); if (autoSetAction != null) { autoButton = new Button("Auto"); setRight(autoButton); setMargin(autoButton, new Insets(0, 0, 0, 10.0)); autoButton.setOnAction(autoSetAction); autoButton.setFocusTraversable(false); } else { autoButton = null; } }
Example 4
Source File: EditAreaEvent.java From helloiot with GNU General Public License v3.0 | 6 votes |
@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: ControlIntensity.java From helloiot with GNU General Public License v3.0 | 6 votes |
@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 6
Source File: BillBoardBehaviorTest.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
private void createOverlay(){ Button b = new Button("Activate"); b.setPrefSize(150, 40); b.setFocusTraversable(false); b.setOnAction(e->{ if(!active){ bill.startBillboardBehavior(); active = true; b.setText("Disable"); }else{ bill.stopBillboardBehavior(); active = false; b.setText("Enable"); } }); CheckBox c = new CheckBox("Toggle Cylindrical Mode"); c.setFont(Font.font(24)); c.setFocusTraversable(false); c.setOnAction(e->{ if(c.isSelected()){ bill.setBillboardMode(BillboardBehavior.BillboardMode.CYLINDRICAL); }else{ bill.setBillboardMode(BillboardBehavior.BillboardMode.SPHERICAL); } }); StackPane.setAlignment(b, Pos.TOP_LEFT); StackPane.setMargin(b, new Insets(10)); StackPane.setAlignment(c, Pos.CENTER_LEFT); StackPane.setMargin(c, new Insets(10)); rootPane.getChildren().addAll(b, c); }
Example 7
Source File: FormulaPane.java From phoebus with Eclipse Public License 1.0 | 5 votes |
private Node createButton(final String text, final String tooltip, final EventHandler<ActionEvent> on_action) { final Button button = new Button(text); button.setFocusTraversable(false); button.setMaxWidth(Double.MAX_VALUE); button.setTooltip(new Tooltip(tooltip)); button.setOnAction(on_action); return button; }
Example 8
Source File: OptionalModuleEditor.java From old-mzmine3 with GNU General Public License v2.0 | 5 votes |
public OptionalModuleEditor(PropertySheet.Item parameter) { if (!(parameter instanceof OptionalModuleParameter)) throw new IllegalArgumentException(); this.optionalModuleParameter = (OptionalModuleParameter) parameter; checkBox = new CheckBox(); setButton = new Button("Setup.."); setButton.setFocusTraversable(false); checkBox.setOnAction(e -> { setButton.setDisable(!checkBox.isSelected()); }); setButton.setDisable(true); setButton.setOnAction(e -> { optionalModuleParameter.getEmbeddedParameters().showSetupDialog(null); // Fire the checkBox to update the validation decorations checkBox.setSelected(false); checkBox.setSelected(true); }); // FlowPane setting setHgap(10); getChildren().addAll(checkBox, setButton); }
Example 9
Source File: FileNameEditor.java From old-mzmine3 with GNU General Public License v2.0 | 5 votes |
public FileNameEditor(PropertySheet.Item parameter) { if (!(parameter instanceof FileNameParameter)) throw new IllegalArgumentException(); this.fileNameParameter = (FileNameParameter) parameter; // The text field this.textField = new TextField(); setCenter(textField); // The Browse button browseButton = new Button("Browse"); browseButton.setFocusTraversable(false); setRight(browseButton); setMargin(browseButton, new Insets(0, 0, 0, 10.0)); browseButton.setOnAction(e -> { List<FileChooser.ExtensionFilter> extensions = fileNameParameter.getExtensions(); FileChooser fileChooser = new FileChooser(); File lastOpenPath = fileNameParameter.getLastOpenPath(); if (lastOpenPath != null) fileChooser.setInitialDirectory(lastOpenPath); fileChooser.setTitle("Find file"); if (extensions != null) { fileChooser.getExtensionFilters().addAll(extensions); } Window parentWindow = this.getScene().getWindow(); File selectedFile; if (fileNameParameter.getFileNameParameterType() == FileNameParameter.Type.OPEN) selectedFile = fileChooser.showOpenDialog(parentWindow); else selectedFile = fileChooser.showSaveDialog(parentWindow); if (selectedFile != null) { textField.setText(selectedFile.getPath()); File parentDir = selectedFile.getParentFile(); fileNameParameter.setLastOpenPath(parentDir); } }); }
Example 10
Source File: ButtonEngine.java From helloiot with GNU General Public License v3.0 | 5 votes |
@Override public Node constructContent() { button = new Button(); button.setContentDisplay(ContentDisplay.TOP); button.getStyleClass().add("buttonbase"); VBox.setVgrow(button, Priority.SOMETIMES); button.setMaxSize(Integer.MAX_VALUE, Integer.MAX_VALUE); button.setFocusTraversable(false); button.armedProperty().addListener(this::onArmedChanged); button.setOnAction(this::onAction); return button; }
Example 11
Source File: ButtonPair.java From helloiot with GNU General Public License v3.0 | 5 votes |
@Override public Node constructContent() { goup = new Button(); goup.setGraphic(IconBuilder.create(IconFontGlyph.FA_SOLID_CHEVRON_UP, 22.0).styleClass("icon-fill").build()); goup.setContentDisplay(ContentDisplay.TOP); goup.getStyleClass().add("buttonbase"); goup.getStyleClass().add("buttonup"); VBox.setVgrow(goup, Priority.SOMETIMES); goup.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); goup.setFocusTraversable(false); goup.setOnAction(event -> { device.sendStatus(roll ? device.rollNextStatus() : device.nextStatus()); }); godown = new Button(); godown.setGraphic(IconBuilder.create(IconFontGlyph.FA_SOLID_CHEVRON_DOWN, 22.0).styleClass("icon-fill").build()); godown.setContentDisplay(ContentDisplay.TOP); godown.getStyleClass().add("buttonbase"); godown.getStyleClass().add("buttondown"); VBox.setVgrow(godown, Priority.SOMETIMES); godown.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); godown.setFocusTraversable(false); godown.setOnAction(event -> { device.sendStatus(roll ? device.rollPrevStatus() : device.prevStatus()); }); // setIconStatus(IconStatus.valueOf("TEXT/ON/OFF")); VBox content = new VBox(goup, godown); content.setSpacing(4); VBox.setVgrow(content, Priority.SOMETIMES); content.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); return content; }
Example 12
Source File: ButtonBase.java From helloiot with GNU General Public License v3.0 | 5 votes |
@Override public Node constructContent() { button = new Button(); button.setContentDisplay(ContentDisplay.TOP); button.getStyleClass().add("buttonbase"); VBox.setVgrow(button, Priority.SOMETIMES); button.setMaxSize(Integer.MAX_VALUE, Integer.MAX_VALUE); button.setFocusTraversable(false); button.setOnAction(this::onScriptAction); return button; }
Example 13
Source File: EditAreaStatus.java From helloiot with GNU General Public License v3.0 | 4 votes |
@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; }
Example 14
Source File: EditStatus.java From helloiot with GNU General Public License v3.0 | 4 votes |
@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 15
Source File: FileNamesEditor.java From old-mzmine3 with GNU General Public License v2.0 | 4 votes |
public FileNamesEditor(PropertySheet.Item parameter) { if (!(parameter instanceof FileNamesParameter)) throw new IllegalArgumentException(); this.fileNamesParameter = (FileNamesParameter) parameter; // The text area this.textArea = new TextArea(); textArea.setPrefHeight(100); setCenter(textArea); // The Add button browseButton = new Button("Browse"); browseButton.setFocusTraversable(false); browseButton.setOnAction(e -> { List<FileChooser.ExtensionFilter> extensions = fileNamesParameter.getExtensions(); FileChooser fileChooser = new FileChooser(); File lastOpenPath = fileNamesParameter.getLastOpenPath(); if ((lastOpenPath != null) && (lastOpenPath.isDirectory())) fileChooser.setInitialDirectory(lastOpenPath); fileChooser.setTitle("Open files"); fileChooser.getExtensionFilters().addAll(extensions); Window parentWindow = this.getScene().getWindow(); List<File> selectedFiles = fileChooser.showOpenMultipleDialog(parentWindow); if (selectedFiles != null) { for (File f : selectedFiles) { if ((textArea.getLength() > 0) && (!textArea.getText().endsWith("\n"))) textArea.appendText("\n"); textArea.appendText(f.getPath()); File parentDir = f.getParentFile(); fileNamesParameter.setLastOpenPath(parentDir); } } }); // The Clear button clearButton = new Button("Clear"); clearButton.setOnAction(e -> { textArea.clear(); }); // The button bar VBox bar = new VBox(10); bar.getChildren().addAll(browseButton, clearButton); setRight(bar); setMargin(bar, new Insets(10.0)); }
Example 16
Source File: ButtonsSpinner.java From helloiot with GNU General Public License v3.0 | 4 votes |
@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 17
Source File: TextAreaEditor.java From old-mzmine3 with GNU General Public License v2.0 | 4 votes |
public TextAreaEditor(PropertySheet.Item parameter) { if (!(parameter instanceof TextAreaParameter)) throw new IllegalArgumentException(); this.textAreaParameter = (TextAreaParameter) parameter; // The text area this.textArea = new TextArea(); textArea.setPrefHeight(100); setCenter(textArea); // The Add button browseButton = new Button("Browse"); browseButton.setFocusTraversable(false); browseButton.setOnAction(e -> { List<FileChooser.ExtensionFilter> extensions = textAreaParameter.getExtensions(); FileChooser fileChooser = new FileChooser(); File lastOpenPath = textAreaParameter.getLastOpenPath(); if (lastOpenPath != null) fileChooser.setInitialDirectory(lastOpenPath); fileChooser.setTitle("Open files"); fileChooser.getExtensionFilters().addAll(extensions); Window parentWindow = this.getScene().getWindow(); List<File> selectedFiles = fileChooser.showOpenMultipleDialog(parentWindow); if (selectedFiles != null) { for (File f : selectedFiles) { if ((textArea.getLength() > 0) && (!textArea.getText().endsWith("\n"))) textArea.appendText("\n"); try { BufferedReader input = new BufferedReader(new FileReader(f)); try { String line = null; while ((line = input.readLine()) != null) { textArea.appendText(line); textArea.appendText("\n"); } } finally { input.close(); } } catch (IOException ex) { ex.printStackTrace(); } File parentDir = f.getParentFile(); textAreaParameter.setLastOpenPath(parentDir); } } }); // The Clear button clearButton = new Button("Clear"); clearButton.setOnAction(e -> { textArea.clear(); }); // The button bar VBox bar = new VBox(10); bar.getChildren().addAll(browseButton, clearButton); setRight(bar); setMargin(bar, new Insets(10.0)); }
Example 18
Source File: FindReplacePane.java From markdown-writer-fx with BSD 2-Clause "Simplified" License | 4 votes |
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents pane = new MigPane(); findField = new CustomTextField(); previousButton = new Button(); nextButton = new Button(); matchCaseButton = new ToggleButton(); regexButton = new ToggleButton(); findInfoLabel = new Label(); closeButton = new Button(); replacePane = new MigPane(); replaceField = new CustomTextField(); replaceButton = new Button(); replaceAllButton = new Button(); replaceInfoLabel = new Label(); nOfHitCountLabel = new Label(); //======== pane ======== { pane.setLayout("insets 0,hidemode 3"); pane.setCols("[shrink 0,fill][fill]0[fill][pref:n,fill]1px[pref:n,fill][grow,fill][fill]"); pane.setRows("[fill]0[]"); //---- findField ---- findField.setPromptText(Messages.get("FindReplacePane.findField.promptText")); findField.setPrefColumnCount(15); pane.add(findField, "cell 0 0"); //---- previousButton ---- previousButton.setFocusTraversable(false); pane.add(previousButton, "cell 1 0"); //---- nextButton ---- nextButton.setFocusTraversable(false); pane.add(nextButton, "cell 2 0"); //---- matchCaseButton ---- matchCaseButton.setText("Aa"); matchCaseButton.setFocusTraversable(false); pane.add(matchCaseButton, "cell 3 0"); //---- regexButton ---- regexButton.setText(".*"); regexButton.setFocusTraversable(false); pane.add(regexButton, "cell 4 0"); pane.add(findInfoLabel, "cell 5 0"); //---- closeButton ---- closeButton.setFocusTraversable(false); pane.add(closeButton, "cell 6 0"); //======== replacePane ======== { replacePane.setLayout("insets rel 0 0 0"); replacePane.setCols("[shrink 0,fill][pref:n,fill][pref:n,fill][grow,fill]"); replacePane.setRows("[]"); //---- replaceField ---- replaceField.setPromptText(Messages.get("FindReplacePane.replaceField.promptText")); replaceField.setPrefColumnCount(15); replacePane.add(replaceField, "cell 0 0"); //---- replaceButton ---- replaceButton.setText(Messages.get("FindReplacePane.replaceButton.text")); replaceButton.setFocusTraversable(false); replacePane.add(replaceButton, "cell 1 0"); //---- replaceAllButton ---- replaceAllButton.setText(Messages.get("FindReplacePane.replaceAllButton.text")); replaceAllButton.setFocusTraversable(false); replacePane.add(replaceAllButton, "cell 2 0"); replacePane.add(replaceInfoLabel, "cell 3 0"); } pane.add(replacePane, "cell 0 1 7 1"); } //---- nOfHitCountLabel ---- nOfHitCountLabel.setText(Messages.get("FindReplacePane.nOfHitCountLabel.text")); // JFormDesigner - End of component initialization //GEN-END:initComponents }
Example 19
Source File: MainNode.java From helloiot with GNU General Public License v3.0 | 4 votes |
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()); }