private void initialize() { this.getStyleClass().add(DEFAULT_STYLE_CLASS); this.setPadding(new Insets(8, 12, 8, 12)); }
private ScrollPane allGlyphs() { List<SVGGlyph> glyphs = SVGGlyphLoader.getAllGlyphsIDs() .stream() .map(glyphName -> { try { return SVGGlyphLoader.getIcoMoonGlyph(glyphName); } catch (Exception e) { return null; } }) .collect(Collectors.toList()); glyphs.sort(Comparator.comparing(SVGGlyph::getName)); glyphs.forEach(glyph -> glyph.setSize(16)); List<Button> iconButtons = glyphs.stream().map(this::createIconButton).collect(Collectors.toList()); // important to improve the performance of animation in scroll pane so buttons are treated as images iconButtons.forEach(button -> button.setCache(true)); Platform.runLater(()->iconButtons.get(0).fire()); FlowPane glyphLayout = new FlowPane(); glyphLayout.setHgap(10); glyphLayout.setVgap(10); glyphLayout.setPadding(new Insets(10)); glyphLayout.getChildren().setAll(iconButtons); glyphLayout.setPrefSize(600, 300); ScrollPane scrollableGlyphs = new ScrollPane(glyphLayout); scrollableGlyphs.setFitToWidth(true); return scrollableGlyphs; }
@Override public void start(Stage primaryStage) { final ToggleGroup group = new ToggleGroup(); JFXRadioButton javaRadio = new JFXRadioButton("JavaFX"); javaRadio.setPadding(new Insets(10)); javaRadio.setToggleGroup(group); JFXRadioButton jfxRadio = new JFXRadioButton("JFoenix"); jfxRadio.setPadding(new Insets(10)); jfxRadio.setToggleGroup(group); VBox vbox = new VBox(); vbox.getChildren().add(javaRadio); vbox.getChildren().add(jfxRadio); vbox.setSpacing(10); HBox hbox = new HBox(); hbox.getChildren().add(vbox); hbox.setSpacing(50); hbox.setPadding(new Insets(40, 10, 10, 120)); Scene scene = new Scene(hbox); primaryStage.setScene(scene); primaryStage.setWidth(500); primaryStage.setHeight(400); primaryStage.setTitle("JFX RadioButton Demo "); scene.getStylesheets() .add(RadioButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); primaryStage.show(); }
protected BorderPane createCalendarMonthLabelPane() { monthYearLabel = new Label(); monthYearLabel.getStyleClass().add(SPINNER_LABEL); monthYearLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 13)); monthYearLabel.setTextFill(DEFAULT_COLOR); BorderPane monthContainer = new BorderPane(); monthContainer.setMinHeight(50); monthContainer.setCenter(monthYearLabel); monthContainer.setPadding(new Insets(2, 12, 2, 12)); return monthContainer; }
@Override public void start(Stage stage) { FlowPane main = new FlowPane(); main.setVgap(20); main.setHgap(20); CheckBox cb = new CheckBox("CheckBox"); JFXCheckBox jfxCheckBox = new JFXCheckBox("JFX CheckBox"); JFXCheckBox customJFXCheckBox = new JFXCheckBox("Custom JFX CheckBox"); customJFXCheckBox.getStyleClass().add("custom-jfx-check-box"); main.getChildren().add(cb); main.getChildren().add(jfxCheckBox); main.getChildren().add(customJFXCheckBox); 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, 600, 200); scene.getStylesheets().add(CheckBoxDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setTitle("JFX CheckBox Demo "); stage.setScene(scene); stage.setResizable(false); stage.show(); }
@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) { FlowPane main = new FlowPane(); main.setVgap(20); main.setHgap(20); javafx.scene.control.ColorPicker picker = new javafx.scene.control.ColorPicker(Color.RED); picker.getStyleClass().add("button"); // picker.getStyleClass().add("split-button"); main.getChildren().add(picker); main.getChildren().add(new JFXColorPicker()); 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) { FlowPane main = new FlowPane(); main.setVgap(20); main.setHgap(20); DatePicker datePicker = new DatePicker(); main.getChildren().add(datePicker); JFXDatePicker datePickerFX = new JFXDatePicker(); main.getChildren().add(datePickerFX); datePickerFX.setPromptText("pick a date"); JFXTimePicker blueDatePicker = new JFXTimePicker(); blueDatePicker.setDefaultColor(Color.valueOf("#3f51b5")); blueDatePicker.setOverLay(true); main.getChildren().add(blueDatePicker); 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, 400, 700); final ObservableList<String> stylesheets = scene.getStylesheets(); stylesheets.addAll(MainDemo.class.getResource("/css/jfoenix-fonts.css").toExternalForm(), MainDemo.class.getResource("/css/jfoenix-design.css").toExternalForm()); stage.setTitle("JFX Date Picker Demo"); stage.setScene(scene); stage.show(); }
@Override public void start(Stage primaryStage) throws Exception { JFXComboBox<Label> combo = new JFXComboBox<>(); combo.getItems().add(new Label("Java 1.8")); combo.getItems().add(new Label("Java 1.7")); combo.getItems().add(new Label("Java 1.6")); combo.getItems().add(new Label("Java 1.5")); combo.setEditable(true); combo.setPromptText("Select Java Version"); combo.setConverter(new StringConverter<Label>() { @Override public String toString(Label object) { return object==null? "" : object.getText(); } @Override public Label fromString(String string) { return new Label(string); } }); HBox pane = new HBox(100); HBox.setMargin(combo, new Insets(20)); pane.setStyle("-fx-background-color:WHITE"); pane.getChildren().add(combo); final Scene scene = new Scene(pane, 300, 300); scene.getStylesheets().add(ComboBoxDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); primaryStage.setTitle("JFX ComboBox Demo"); primaryStage.setScene(scene); primaryStage.setResizable(false); primaryStage.show(); }
@Override public void start(Stage primaryStage) throws Exception { JFXHamburger show = new JFXHamburger(); show.setPadding(new Insets(10, 5, 10, 5)); JFXRippler rippler = new JFXRippler(show, RipplerMask.CIRCLE, RipplerPos.BACK); JFXListView<Label> list = new JFXListView<>(); for (int i = 1; i < 5; i++) { list.getItems().add(new Label("Item " + i)); } AnchorPane container = new AnchorPane(); container.getChildren().add(rippler); AnchorPane.setLeftAnchor(rippler, 200.0); AnchorPane.setTopAnchor(rippler, 210.0); StackPane main = new StackPane(); main.getChildren().add(container); JFXPopup popup = new JFXPopup(list); rippler.setOnMouseClicked(e -> popup.show(rippler, PopupVPosition.TOP, PopupHPosition.LEFT)); final Scene scene = new Scene(main, 800, 800); scene.getStylesheets().add(PopupDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); primaryStage.setTitle("JFX Popup Demo"); primaryStage.setScene(scene); primaryStage.setResizable(false); primaryStage.show(); }
public JFXButton createFirstButton(TreeItem temp) { return new JFXButton(temp.getValue().toString()) { { setPadding(new Insets(getOffset(), 1.5 * getOffset(), getOffset(), getOffset())); setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); } @Override protected void layoutChildren() { super.layoutChildren(); double width = getWidth(); Polygon polygon = new Polygon(); final double height = getHeight(); polygon.getPoints().addAll(new Double[] { 0.0, 0.0, width - getOffset(), 0.0, width, height / 2, width - getOffset(), height, 0.0, height}); setClip(polygon); } }; }
@Override public void start(Stage stage) { JFXChipView<String> chipView = new JFXChipView<>(); chipView.getChips().addAll("WEF", "WWW", "JD"); chipView.getSuggestions().addAll("HELLO", "TROLL", "WFEWEF", "WEF"); chipView.setStyle("-fx-background-color: WHITE;"); StackPane pane = new StackPane(); pane.getChildren().add(chipView); StackPane.setMargin(chipView, new Insets(100)); pane.setStyle("-fx-background-color:GRAY;"); final Scene scene = new Scene(pane, 500, 500); // scene.getStylesheets().add(TagAreaDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setTitle("JFX Button Demo"); stage.setScene(scene); stage.show(); // ScenicView.show(scene); }
private JFXButton createLastButton(TreeItem temp, TreeItem parent) { return new JFXButton(temp.getValue().toString()) { private boolean noParent = parent == null; { setPadding(new Insets(getOffset(), getOffset(), getOffset(), (noParent? 1 : 2) * getOffset())); setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); } @Override protected void layoutChildren() { super.layoutChildren(); double width = getWidth(); Polygon polygon = new Polygon(); final double height = getHeight(); polygon.getPoints().addAll(new Double[] { 0.0, 0.0, width, 0.0, width, height, 0.0, height, noParent ? 0 : getOffset(), noParent ? 0 : height / 2}); setClip(polygon); } }; }
private JFXButton createNextButton(TreeItem temp) { return new JFXButton(temp.getValue().toString()) { { setPadding(new Insets(getOffset(), 1.5 * getOffset(), getOffset(), 2 * getOffset())); setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); } @Override protected void layoutChildren() { super.layoutChildren(); double width = getWidth(); Polygon polygon = new Polygon(); final double height = getHeight(); polygon.getPoints().addAll(new Double[] { 0.0, 0.0, width - getOffset(), 0.0, width, height / 2, width - getOffset(), height, 0.0, height, getOffset(), height / 2}); setClip(polygon); } }; }
container.setPadding(new Insets(24)); JFXScrollPane.smoothScrolling((ScrollPane) pane.getChildren().get(0)); StackPane.setMargin(title, new Insets(0, 0, 0, 80)); StackPane.setAlignment(title, Pos.CENTER_LEFT); StackPane.setAlignment(button, Pos.CENTER_LEFT); StackPane.setMargin(button, new Insets(0, 0, 0, 20));
StackPane.setMargin(main, new Insets(100)); pane.setStyle("-fx-background-color:WHITE");
@Override public Button createNode() { final Button btn = new Button(text, icon.view()); btn.setTextAlignment(TextAlignment.CENTER); btn.setAlignment(Pos.CENTER); btn.setMnemonicParsing(false); btn.setLayoutX(10); btn.setLayoutY(10); btn.setPadding(new Insets(8, 12, 8, 12)); btn.setOnAction(handler); btn.setTooltip(new Tooltip(tooltip)); return btn; } }
@Override public void start(Stage stage) { JFXSlider horLeftSlider = new JFXSlider(); horLeftSlider.setMinWidth(500); JFXSlider horRightSlider = new JFXSlider(); horRightSlider.setMinWidth(500); horRightSlider.setIndicatorPosition(IndicatorPosition.RIGHT); JFXSlider verLeftSlider = new JFXSlider(); verLeftSlider.setMinHeight(500); verLeftSlider.setOrientation(Orientation.VERTICAL); JFXSlider verRightSlider = new JFXSlider(); verRightSlider.setMinHeight(500); verRightSlider.setOrientation(Orientation.VERTICAL); verRightSlider.setIndicatorPosition(IndicatorPosition.RIGHT); HBox hbox = new HBox(); hbox.setSpacing(450); hbox.getChildren().addAll(verRightSlider, verLeftSlider); VBox vbox = new VBox(); vbox.getChildren().addAll(horRightSlider, horLeftSlider, hbox); vbox.setSpacing(100); vbox.setPadding(new Insets(100, 50, 50, 150)); Scene scene = new Scene(new Group()); ((Group) scene.getRoot()).getChildren().add(vbox); scene.getStylesheets().add(SliderDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setScene(scene); stage.setWidth(900); stage.setHeight(900); stage.show(); stage.setTitle("JFX Slider Demo"); }
boxContainer.setPadding(new Insets(padding)); rippler = new JFXRippler(boxContainer, RipplerMask.CIRCLE); rippler.setRipplerFill(getSkinnable().isSelected() ? control.getUnCheckedColor() : control.getCheckedColor());