rightChevron.setSize(6, 11); backMonthButton = new JFXButton(); backMonthButton.setMinSize(40, 40); backMonthButton.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, new CornerRadii(40), Insets.EMPTY))); backMonthButton.getStyleClass().add("left-button"); backMonthButton.setGraphic(leftChevron); backMonthButton.setRipplerFill(this.datePicker.getDefaultColor()); backMonthButton.setOnAction(t -> forward(-1, MONTHS, false, true)); forwardMonthButton = new JFXButton(); forwardMonthButton.setMinSize(40, 40); forwardMonthButton.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, new CornerRadii(40), Insets.EMPTY))); forwardMonthButton.getStyleClass().add("right-button"); forwardMonthButton.setGraphic(rightChevron); forwardMonthButton.setRipplerFill(this.datePicker.getDefaultColor()); forwardMonthButton.setOnAction(t -> forward(1, MONTHS, false, true));
@Override public void start(Stage stage) { FlowPane main = new FlowPane(); main.setVgap(20); main.setHgap(20); main.getChildren().add(new Button("Java Button")); JFXButton jfoenixButton = new JFXButton("JFoenix Button"); main.getChildren().add(jfoenixButton); JFXButton button = new JFXButton("RAISED BUTTON"); button.getStyleClass().add("button-raised"); main.getChildren().add(button); JFXButton button1 = new JFXButton("DISABLED"); button1.setDisable(true); main.getChildren().add(button1); StackPane pane = new StackPane(); pane.getChildren().add(main); StackPane.setMargin(main, new Insets(100)); pane.setStyle("-fx-background-color:WHITE"); final Scene scene = new Scene(pane, 800, 200); scene.getStylesheets().add(ButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setTitle("JFX Button Demo"); stage.setScene(scene); stage.show(); }
@Override public void start(Stage stage) { JFXButton ssbutton1 = new JFXButton(); Label sslabel = new Label("R1"); sslabel.setStyle(FX_TEXT_FILL_WHITE); ssbutton1.setGraphic(sslabel); ssbutton1.setButtonType(ButtonType.RAISED); ssbutton1.getStyleClass().addAll(ANIMATED_OPTION_BUTTON, ANIMATED_OPTION_SUB_BUTTON2); JFXButton ssbutton2 = new JFXButton("R2"); ssbutton2.setTooltip(new Tooltip("Button R2")); ssbutton2.setButtonType(ButtonType.RAISED); ssbutton2.getStyleClass().addAll(ANIMATED_OPTION_BUTTON, ANIMATED_OPTION_SUB_BUTTON2); JFXButton ssbutton3 = new JFXButton("R3"); ssbutton3.setButtonType(ButtonType.RAISED); ssbutton3.getStyleClass().addAll(ANIMATED_OPTION_BUTTON, ANIMATED_OPTION_SUB_BUTTON2); JFXButton sbutton1 = new JFXButton(); Label slabel = new Label("B1"); slabel.setStyle(FX_TEXT_FILL_WHITE); sbutton1.setGraphic(slabel); sbutton1.setButtonType(ButtonType.RAISED); sbutton1.getStyleClass().addAll(ANIMATED_OPTION_BUTTON, ANIMATED_OPTION_SUB_BUTTON); JFXButton sbutton2 = new JFXButton("B2"); sbutton2.setTooltip(new Tooltip("Button B2")); sbutton2.setButtonType(ButtonType.RAISED); sbutton2.getStyleClass().addAll(ANIMATED_OPTION_BUTTON, ANIMATED_OPTION_SUB_BUTTON);
Color.WHITE); close.setSize(12, 12); btnFull = new JFXButton(); btnFull.getStyleClass().add("jfx-decorator-button"); btnFull.setCursor(Cursor.HAND); btnFull.setOnAction((action) -> primaryStage.setFullScreen(!primaryStage.isFullScreen())); btnFull.setGraphic(full); btnFull.setTranslateX(-30); btnFull.setRipplerFill(Color.WHITE); btnClose = new JFXButton(); btnClose.getStyleClass().add("jfx-decorator-button"); btnClose.setCursor(Cursor.HAND); btnClose.setOnAction((action) -> onCloseButtonAction.get().run()); btnClose.setGraphic(close); btnClose.setRipplerFill(Color.WHITE); btnMin = new JFXButton(); btnMin.getStyleClass().add("jfx-decorator-button"); btnMin.setCursor(Cursor.HAND); btnMin.setOnAction((action) -> primaryStage.setIconified(true)); btnMin.setGraphic(minus); btnMin.setRipplerFill(Color.WHITE); btnMax = new JFXButton(); btnMax.getStyleClass().add("jfx-decorator-button"); btnMax.setCursor(Cursor.HAND); btnMax.setRipplerFill(Color.WHITE); btnMax.setOnAction((action) -> maximize(resizeMin, resizeMax));
button.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> playClickAnimation(1)); button.addEventFilter(MouseEvent.MOUSE_PRESSED, e-> mousePressed = true); button.addEventFilter(MouseEvent.MOUSE_RELEASED, e-> mousePressed = false); button.addEventFilter(MouseEvent.MOUSE_DRAGGED, e-> mousePressed = false); button.ripplerFillProperty().addListener((o, oldVal, newVal) -> buttonRippler.setRipplerFill(newVal)); button.armedProperty().addListener((o, oldVal, newVal) -> { if (newVal) { if (!mousePressed) { button.focusedProperty().addListener((o, oldVal, newVal) -> { if(!button.disableVisualFocusProperty().get()){ if (newVal){ if (!getSkinnable().isPressed()){ button.buttonTypeProperty().addListener((o, oldVal, newVal) -> updateButtonType(newVal)); button.setPickOnBounds(false); updateButtonType(button.getButtonType());
JFXButton button = new JFXButton(""); button.setButtonType(ButtonType.RAISED); button.setStyle("-fx-background-radius: 40;-fx-background-color: " + getDefaultColor((int) ((Math.random() * 12) % 12))); button.setPrefSize(40, 40); button.setRipplerFill(Color.valueOf(headerColor)); button.setScaleX(0); button.setScaleY(0); SVGGlyph glyph = new SVGGlyph(-1, "test", Color.WHITE); glyph.setSize(20, 20); button.setGraphic(glyph); button.translateYProperty().bind(Bindings.createDoubleBinding(() -> { return header.getBoundsInParent().getHeight() - button.getHeight() / 2; }, header.boundsInParentProperty(), button.heightProperty())); StackPane.setMargin(button, new Insets(0, 12, 0, 0)); StackPane.setAlignment(button, Pos.TOP_RIGHT); new KeyValue(button.scaleXProperty(), 1, EASE_BOTH), new KeyValue(button.scaleYProperty(), 1, EASE_BOTH)));
action = new JFXButton(); action.setText(actionText); action.setOnAction(actionHandler); action.setMinWidth(Control.USE_PREF_SIZE); action.setButtonType(JFXButton.ButtonType.FLAT); action.getStyleClass().add("jfx-snackbar-action"); action.setVisible(true); actionContainer.setVisible(true); actionContainer.setManaged(true); action.setText(""); action.setText(actionText); action.setOnAction(actionHandler); } else { actionContainer.setVisible(false); actionContainer.setManaged(false); action.setVisible(false);
private Button createIconButton(SVGGlyph glyph) { JFXButton button = new JFXButton(null, glyph); button.setPrefSize(30,30); button.setMinSize(30,30); button.setMaxSize(30,30); button.ripplerFillProperty().bind(glyphDetailViewer.colorPicker.valueProperty()); glyphDetailViewer.colorPicker.valueProperty().addListener((o, oldVal, newVal) -> { String webColor = "#" + Integer.toHexString(newVal.hashCode()).substring(0, 6).toUpperCase(); .substring(0, 8); final BackgroundFill backgroundFill = new BackgroundFill(Color.valueOf(currentColor + DEFAULT_OPACITY), lastClicked.getBackground().getFills().get(0).getRadii(), null); lastClicked.setBackground(new Background(backgroundFill)); button.setOnAction(event -> { if (lastClicked != null) { lastClicked.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, lastClicked.getBackground().getFills().get(0).getRadii(), null))); .substring(0, 8); button.setBackground(new Background(new BackgroundFill(Color.valueOf(currentColor + DEFAULT_OPACITY), button.getBackground() == null ? null : button.getBackground().getFills().get(0).getRadii(), null))); lastClicked = button;
centerButton.setOnAction(action -> { dialog.setTransitionType(DialogTransition.CENTER); dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE)); }); topButton.setOnAction(action -> { dialog.setTransitionType(DialogTransition.TOP); dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE)); }); rightButton.setOnAction(action -> { dialog.setTransitionType(DialogTransition.RIGHT); dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE)); }); bottomButton.setOnAction(action -> { dialog.setTransitionType(DialogTransition.BOTTOM); dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE)); }); leftButton.setOnAction(action -> { dialog.setTransitionType(DialogTransition.LEFT); dialog.show((StackPane) context.getRegisteredObject(CONTENT_PANE)); }); acceptButton.setOnAction(action -> dialog.close()); alertButton.setOnAction(action -> { JFXAlert alert = new JFXAlert((Stage) alertButton.getScene().getWindow());
public JFXDefaultChip(JFXChipView<T> view, T item) { super(view, item); JFXButton closeButton = new JFXButton(null, new SVGGlyph()); closeButton.getStyleClass().add("close-button"); closeButton.setOnAction((event) -> view.getChips().remove(item)); String tagString = null; if (getItem() instanceof String) { tagString = (String) getItem(); } else { tagString = view.getConverter().toString(getItem()); } Label label = new Label(tagString); label.setWrapText(true); root = new HBox(label, closeButton); getChildren().setAll(root); label.setMaxWidth(100); } }
@Override public Node build() { leftButton = new JFXButton("Alert"); leftButton.setLayoutX(50); leftButton.setLayoutY(50); return new Group(leftButton); }
pane.setContent(container); JFXButton button = new JFXButton(""); SVGGlyph arrow = new SVGGlyph(0, "FULLSCREEN", Color.WHITE); arrow.setSize(20, 16); button.setGraphic(arrow); button.setRipplerFill(Color.WHITE); pane.getTopBar().getChildren().add(button);
JFXButton groupButton = new JFXButton("Group"); groupButton.setOnAction((action) -> new Thread(() -> treeView.group(empColumn)).start()); main.getChildren().add(groupButton); JFXButton unGroupButton = new JFXButton("unGroup"); unGroupButton.setOnAction((action) -> treeView.unGroup(empColumn)); main.getChildren().add(unGroupButton);
colorPickerGrid.getChildren().get(0).requestFocus(); customColorLabel.setAlignment(Pos.CENTER_LEFT); customColorLink.setPrefWidth(colorPickerGrid.prefWidth(-1)); customColorLink.setAlignment(Pos.CENTER); customColorLink.setFocusTraversable(true); customColorLink.setOnAction(ev -> { if (customColorDialog == null) { customColorDialog = new JFXCustomColorPickerDialog(popupControl);
private void initButtons() { // START AND STOP this.startButton.setOnMouseClicked(e -> { if (e.getButton().equals(MouseButton.SECONDARY)) { this.elevationPopup.show(this.startButton); } else { if (this.recognizer.state()) { this.stopSensor(); this.startButton.setTooltip(new Tooltip("Start the sensor")); this.startButton.setGraphic(ViewUtilities.iconSetter(Material.VISIBILITY, IconDim.MEDIUM)); } else { this.startSensor(); this.startButton.setTooltip(new Tooltip("Start the sensor")); this.startButton.setGraphic(ViewUtilities.iconSetter(Material.VISIBILITY_OFF, IconDim.MEDIUM)); } } }); // SAVE BUTTON this.saveSettingsButton.setGraphic(ViewUtilities.iconSetter(Material.SAVE, IconDim.MEDIUM)); JFXDepthManager.setDepth(this.saveSettingsButton, 4); this.saveSettingsButton.setOnAction(t -> this.saveSettings()); }
final Text titolo = new Text(title); final Text descrizione = new Text(description); final JFXButton buttonYes = new JFXButton("YES"); final JFXButton buttonNo = new JFXButton("NO"); switch (size) { case SMALL: final JFXDialog dialog = new JFXDialog(mainPane, content, JFXDialog.DialogTransition.CENTER); dialog.getStyleClass().add("confirmDialogBackground"); buttonYes.setOnMouseClicked(ev); buttonNo.setOnMouseClicked(ev); buttonYes.setOnAction(t -> dialog.close()); buttonNo.setOnAction(t -> dialog.close()); dialog.show();
pane.setStyle("-fx-background-color:WHITE"); JFXButton button3D = new JFXButton("3D"); button3D.setOnMouseClicked(e -> list.depthProperty().set(++counter % 2)); JFXButton buttonExpand = new JFXButton("EXPAND"); buttonExpand.setOnMouseClicked(e -> { list.depthProperty().set(1); list.setExpanded(true); }); JFXButton buttonCollapse = new JFXButton("COLLAPSE"); buttonCollapse.setOnMouseClicked(e -> { list.depthProperty().set(1); list.setExpanded(false);
maximized = primaryStage.isMaximized(); if (primaryStage.isMaximized()) { btnMax.setGraphic(resizeMin); btnMax.setTooltip(new Tooltip("Restore Down")); } else { btnMax.setGraphic(resizeMax); btnMax.setTooltip(new Tooltip("Maximize")); primaryStage.setWidth(maximizedBox.getWidth()); primaryStage.setHeight(maximizedBox.getHeight()); btnMax.setGraphic(resizeMin); btnMax.setTooltip(new Tooltip("Restore Down")); } else { primaryStage.setHeight(originalBox.getHeight()); originalBox = null; btnMax.setGraphic(resizeMax); btnMax.setTooltip(new Tooltip("Maximize"));
@Override public void start(Stage stage) { FlowPane content = new FlowPane(); JFXButton leftButton = new JFXButton(LEFT); JFXButton topButton = new JFXButton(TOP); JFXButton rightButton = new JFXButton(RIGHT); JFXButton bottomButton = new JFXButton(BOTTOM); content.getChildren().addAll(leftButton, topButton, rightButton, bottomButton); content.setMaxSize(200, 200); StackPane leftDrawerPane = new StackPane(); leftDrawerPane.getStyleClass().add("red-400"); leftDrawerPane.getChildren().add(new JFXButton("Left Content")); leftDrawer.setSidePane(leftDrawerPane); leftDrawer.setDefaultDrawerSize(150); StackPane bottomDrawerPane = new StackPane(); bottomDrawerPane.getStyleClass().add("deep-purple-400"); bottomDrawerPane.getChildren().add(new JFXButton("Bottom Content")); bottomDrawer.setDefaultDrawerSize(150); bottomDrawer.setDirection(DrawerDirection.BOTTOM); StackPane rightDrawerPane = new StackPane(); rightDrawerPane.getStyleClass().add("blue-400"); rightDrawerPane.getChildren().add(new JFXButton("Right Content")); rightDrawer.setDirection(DrawerDirection.RIGHT); rightDrawer.setDefaultDrawerSize(150); StackPane topDrawerPane = new StackPane(); topDrawerPane.getStyleClass().add("green-400");
/** * init fxml when loaded. */ @PostConstruct public void init() { for (int i = 0; i < 100; i++) { contentList.getItems().add("Item " + i); } contentList.setMaxHeight(3400); JFXScrollPane.smoothScrolling((ScrollPane) scroll.getChildren().get(0)); SVGGlyph arrow = new SVGGlyph(0, "FULLSCREEN", "M402.746 877.254l-320-320c-24.994-24.992-24.994-65.516 0-90.51l320-320c24.994-24.992 65.516-24.992 90.51 0 24.994 24.994 " + "24.994 65.516 0 90.51l-210.746 210.746h613.49c35.346 0 64 28.654 64 64s-28.654 64-64 64h-613.49l210.746 210.746c12.496 " + "12.496 18.744 28.876 18.744 45.254s-6.248 32.758-18.744 45.254c-24.994 24.994-65.516 24.994-90.51 0z", Color.WHITE); arrow.setSize(20, 16); backButton.setGraphic(arrow); backButton.setRipplerFill(Color.WHITE); } }