├── AccordionDemo ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── FXUtils.class │ │ ├── Launcher.class │ │ ├── MainView.class │ │ └── stylesheet.css ├── build.fxbuild ├── circle.png ├── octagon.png ├── square.png ├── src │ └── com │ │ └── javacodejunkie │ │ ├── FXUtils.java │ │ ├── Launcher.java │ │ ├── MainView.java │ │ └── stylesheet.css └── triangle.png ├── AlertDemo ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── Launcher.class │ │ ├── MainView.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── Launcher.java │ ├── MainView.java │ └── stylesheet.css ├── AnchorPane Explorer ├── AnchorPane Explorer.iml ├── out │ └── production │ │ └── AnchorPane Explorer │ │ └── sample │ │ ├── Controller.class │ │ ├── Main.class │ │ ├── application.css │ │ └── sample.fxml └── src │ └── sample │ ├── Controller.java │ ├── Main.java │ ├── application.css │ └── sample.fxml ├── BindingDemo ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── Launcher.class │ │ ├── MainView.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── Launcher.java │ ├── MainView.java │ └── stylesheet.css ├── BorderPaneDemo-3 ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── FXMenu.class │ │ ├── FXStatusBar.class │ │ ├── FXToolBar.class │ │ ├── Launcher.class │ │ ├── MainView.class │ │ ├── Person.class │ │ ├── PersonEvent.class │ │ ├── PersonForm$1.class │ │ ├── PersonForm.class │ │ ├── PersonTable.class │ │ ├── images │ │ ├── exit.png │ │ ├── open.png │ │ └── save.png │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── FXMenu.java │ ├── FXStatusBar.java │ ├── FXToolBar.java │ ├── Launcher.java │ ├── MainView.java │ ├── Person.java │ ├── PersonEvent.java │ ├── PersonForm.java │ ├── PersonTable.java │ ├── images │ ├── exit.png │ ├── open.png │ └── save.png │ └── stylesheet.css ├── BorderPaneDemo ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── Launcher.class │ │ ├── MainView.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── Launcher.java │ ├── MainView.java │ └── stylesheet.css ├── BorderPaneDemo2 ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── FXForm.class │ │ ├── FXMenu.class │ │ ├── FXStatusBar.class │ │ ├── FXTable.class │ │ ├── FXToolBar.class │ │ ├── Launcher.class │ │ ├── MainView.class │ │ ├── Person.class │ │ ├── images │ │ ├── exit.png │ │ ├── open.png │ │ └── save.png │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── FXForm.java │ ├── FXMenu.java │ ├── FXStatusBar.java │ ├── FXTable.java │ ├── FXToolBar.java │ ├── Launcher.java │ ├── MainView.java │ ├── Person.java │ ├── images │ ├── exit.png │ ├── open.png │ └── save.png │ └── stylesheet.css ├── ButtonBarDemo ├── bin │ └── application │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── ButtonExplorer ├── bin │ └── application │ │ ├── Main.class │ │ ├── SaveButtonHandler.class │ │ ├── SaveEvent.class │ │ ├── SaveEventHandler.class │ │ ├── Sphere3D.class │ │ ├── application.css │ │ ├── ok.png │ │ └── save.png ├── build.fxbuild └── src │ └── application │ ├── Main.java │ ├── SaveEvent.java │ ├── SaveEventHandler.java │ ├── Sphere3D.java │ ├── application.css │ ├── ok.png │ └── save.png ├── ChangeListenerDemo ├── bin │ └── application │ │ ├── FXUtils.class │ │ ├── Main$1.class │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── FXUtils.java │ ├── Main.java │ └── application.css ├── CheckBox Demo ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── Launcher.class │ │ ├── MainView$CheckBoxHandler.class │ │ ├── MainView$ExpandedPropertyListener.class │ │ ├── MainView$TitledPaneHandler.class │ │ ├── MainView.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── Launcher.java │ ├── MainView.java │ └── stylesheet.css ├── ComboBoxDemo ├── bin │ └── application │ │ ├── Main$1.class │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── CreateStage ├── bin │ └── application │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── CustomEvents-1 ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── FXMenu.class │ │ ├── FXStatusBar.class │ │ ├── FXToolBar.class │ │ ├── Launcher.class │ │ ├── MainView.class │ │ ├── Person.class │ │ ├── PersonEvent.class │ │ ├── PersonForm$1.class │ │ ├── PersonForm.class │ │ ├── PersonTable.class │ │ ├── images │ │ ├── exit.png │ │ ├── open.png │ │ └── save.png │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── FXMenu.java │ ├── FXStatusBar.java │ ├── FXToolBar.java │ ├── Launcher.java │ ├── MainView.java │ ├── Person.java │ ├── PersonEvent.java │ ├── PersonForm.java │ ├── PersonTable.java │ ├── images │ ├── exit.png │ ├── open.png │ └── save.png │ └── stylesheet.css ├── DatePickerDemo ├── bin │ └── application │ │ ├── Main$1.class │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── DialogDemo ├── bin │ └── application │ │ ├── Main$1.class │ │ ├── Main.class │ │ ├── Person.class │ │ ├── PersonDialog$1.class │ │ ├── PersonDialog$2.class │ │ ├── PersonDialog.class │ │ ├── application.css │ │ ├── dial.png │ │ └── person.png ├── build.fxbuild └── src │ └── application │ ├── Main.java │ ├── Person.java │ ├── PersonDialog.java │ ├── application.css │ ├── dial.png │ └── person.png ├── EventExplorer ├── bin │ └── application │ │ ├── Main$1.class │ │ ├── Main.class │ │ ├── MyEventHandler.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── EventExplorer2 ├── bin │ └── application │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── FileChooserDemo ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── FXUtils.class │ │ ├── Launcher.class │ │ ├── MainView$1.class │ │ ├── MainView$2.class │ │ ├── MainView$3.class │ │ ├── MainView.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── FXUtils.java │ ├── Launcher.java │ ├── MainView.java │ └── stylesheet.css ├── FlowPane Explorer ├── FlowPane Explorer.iml ├── out │ └── production │ │ └── FlowPane Explorer │ │ └── sample │ │ ├── Controller.class │ │ ├── Main.class │ │ └── sample.fxml └── src │ └── sample │ ├── Controller.java │ ├── Main.java │ └── sample.fxml ├── GridPaneDemo ├── bin │ └── application │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── HBox Explorer ├── bin │ └── application │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── JavaFX CSS Demo ├── bin │ └── application │ │ ├── Main$1.class │ │ ├── Main$2.class │ │ ├── Main.class │ │ ├── purple2.png │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ ├── purple2.png │ └── stylesheet.css ├── JavaFX Project (Template) ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── FXHelper.class │ │ ├── Launcher.class │ │ ├── MainView.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── FXHelper.java │ ├── FXUtils.java │ ├── Launcher.java │ ├── MainView.java │ └── stylesheet.css ├── LICENSE ├── LabelExplorer ├── bin │ └── application │ │ ├── Main.class │ │ ├── application.css │ │ └── ok.png ├── build.fxbuild └── src │ └── application │ ├── Main.java │ ├── application.css │ └── ok.png ├── LifeCycle ├── bin │ └── application │ │ └── Main.class └── src │ └── application │ └── Main.java ├── ListViewDemo ├── bin │ └── application │ │ ├── FXUtils.class │ │ ├── Main$1.class │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── FXUtils.java │ ├── Main.java │ └── application.css ├── MenuDemo ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── FXUtils.class │ │ ├── Launcher.class │ │ ├── MainView.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── FXUtils.java │ ├── Launcher.java │ ├── MainView.java │ └── stylesheet.css ├── PaneLayout ├── bin │ └── application │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── ProgressBarDemo ├── bin │ └── application │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── PropertiesDemo ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── Main$1.class │ │ ├── Main.class │ │ └── Person.class └── src │ └── com │ └── javacodejunkie │ ├── Main.java │ └── Person.java ├── RadioButtonDemo ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── Launcher.class │ │ ├── MainView$1.class │ │ ├── MainView.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── Launcher.java │ ├── MainView.java │ └── stylesheet.css ├── SceneBuilderIntro ├── bin │ └── application │ │ ├── Main.class │ │ ├── Sample.fxml │ │ ├── SampleController.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ ├── Sample.fxml │ ├── SampleController.java │ └── application.css ├── SceneExplorer ├── bin │ └── application │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── SliderDemo ├── bin │ └── application │ │ ├── FXUtils.class │ │ ├── Main$1.class │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── FXUtils.java │ ├── Main.java │ └── application.css ├── SpinnerDemo ├── bin │ └── application │ │ ├── FXUtils.class │ │ ├── Main.class │ │ ├── WeekDay.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── FXUtils.java │ ├── Main.java │ ├── WeekDay.java │ └── application.css ├── StackPane Demo ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── Launcher.class │ │ ├── MainView.class │ │ ├── stylesheet.css │ │ └── yoda.jpg ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── Launcher.java │ ├── MainView.java │ ├── stylesheet.css │ └── yoda.jpg ├── StageExplorer ├── bin │ └── application │ │ ├── Main.class │ │ ├── MyStage$MyEventHandler.class │ │ ├── MyStage.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── SwitchingScenesDemo ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── Launcher.class │ │ ├── MainView$1.class │ │ ├── MainView$2.class │ │ ├── MainView$3.class │ │ ├── MainView$4.class │ │ ├── MainView.class │ │ ├── SwitchScenesA.class │ │ ├── SwitchScenesB.class │ │ ├── SwitchScenesC.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── Launcher.java │ ├── MainView.java │ ├── SwitchScenesA.java │ ├── SwitchScenesB.java │ ├── SwitchScenesC.java │ └── stylesheet.css ├── TabEvents ├── bin │ └── application │ │ ├── Main$1.class │ │ ├── Main$2.class │ │ ├── Main$3.class │ │ ├── Main$4.class │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── TabPaneDemo ├── bin │ └── application │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── TableViewDemo-2 ├── bin │ └── application │ │ ├── Main$1.class │ │ ├── Main$2.class │ │ ├── Main$3.class │ │ ├── Main.class │ │ ├── Person.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ ├── Person.java │ └── stylesheet.css ├── TableViewDemo-3 ├── bin │ └── application │ │ ├── MainView.class │ │ ├── Person.class │ │ ├── PersonTableView$1.class │ │ ├── PersonTableView$2.class │ │ ├── PersonTableView$3.class │ │ ├── PersonTableView.class │ │ ├── TableViewDemo.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── application │ ├── MainView.java │ ├── Person.java │ ├── PersonTableView.java │ ├── TableViewDemo.java │ └── stylesheet.css ├── TableViewDemo ├── bin │ └── application │ │ ├── Main.class │ │ ├── Person.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ ├── Person.java │ └── stylesheet.css ├── TextAreaDemo ├── bin │ └── application │ │ ├── FXUtils.class │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── FXUtils.java │ ├── Main.java │ └── application.css ├── TextDemo ├── bin │ └── application │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── TextFieldExplorer ├── bin │ └── application │ │ ├── Main$1.class │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── TitledPane Demo ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── Launcher.class │ │ ├── MainView.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── Launcher.java │ ├── MainView.java │ └── stylesheet.css ├── VBox Explorer ├── bin │ └── application │ │ ├── Main.class │ │ └── application.css ├── build.fxbuild └── src │ └── application │ ├── Main.java │ └── application.css ├── WindowEvents ├── bin │ └── com │ │ └── javacodejunkie │ │ ├── FXUtils.class │ │ ├── Launcher.class │ │ ├── MainView$1.class │ │ ├── MainView.class │ │ └── stylesheet.css ├── build.fxbuild └── src │ └── com │ └── javacodejunkie │ ├── FXUtils.java │ ├── Launcher.java │ ├── MainView.java │ └── stylesheet.css └── ZuluTest ├── bin └── com │ └── javacodejunkie │ └── Main.class └── src └── com └── javacodejunkie └── Main.java /AccordionDemo/bin/com/javacodejunkie/FXUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/AccordionDemo/bin/com/javacodejunkie/FXUtils.class -------------------------------------------------------------------------------- /AccordionDemo/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/AccordionDemo/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /AccordionDemo/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/AccordionDemo/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /AccordionDemo/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } 4 | 5 | .accordion { 6 | -fx-padding: 5px; 7 | -fx-background-color: slategray; 8 | } 9 | 10 | 11 | -------------------------------------------------------------------------------- /AccordionDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AccordionDemo/circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/AccordionDemo/circle.png -------------------------------------------------------------------------------- /AccordionDemo/octagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/AccordionDemo/octagon.png -------------------------------------------------------------------------------- /AccordionDemo/square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/AccordionDemo/square.png -------------------------------------------------------------------------------- /AccordionDemo/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | MainView mainView = new MainView(primaryStage); 11 | mainView.show(); 12 | } 13 | 14 | public static void main(String[] args) { 15 | launch(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /AccordionDemo/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } 4 | 5 | .accordion { 6 | -fx-padding: 5px; 7 | -fx-background-color: slategray; 8 | } 9 | 10 | 11 | -------------------------------------------------------------------------------- /AccordionDemo/triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/AccordionDemo/triangle.png -------------------------------------------------------------------------------- /AlertDemo/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/AlertDemo/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /AlertDemo/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/AlertDemo/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /AlertDemo/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /AlertDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AlertDemo/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | MainView mainView = new MainView(primaryStage); 11 | mainView.show(); 12 | } 13 | 14 | public static void main(String[] args) { 15 | launch(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /AlertDemo/src/com/javacodejunkie/MainView.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import java.util.Optional; 4 | 5 | import javafx.event.ActionEvent; 6 | import javafx.event.EventHandler; 7 | import javafx.scene.Scene; 8 | import javafx.scene.control.Alert; 9 | import javafx.scene.control.Alert.AlertType; 10 | import javafx.scene.control.Button; 11 | import javafx.scene.control.ButtonType; 12 | import javafx.scene.layout.StackPane; 13 | import javafx.stage.Stage; 14 | 15 | public class MainView { 16 | 17 | public Stage stage; 18 | private StackPane root; 19 | private Scene scene; 20 | 21 | public MainView(Stage stage) { 22 | this.stage = stage; 23 | buildUI(); 24 | } 25 | 26 | private void buildUI() { 27 | root = new StackPane(); 28 | 29 | Button button = new Button("Show Alert"); 30 | 31 | button.setOnAction(new EventHandler() { 32 | @Override 33 | public void handle(ActionEvent event) { 34 | Alert alert = new Alert(AlertType.CONFIRMATION); 35 | alert.setTitle("Please Confirm"); 36 | alert.setHeaderText("Please consider Subscribing"); 37 | alert.setContentText("Please Subscribe so that you will be notified when I release new videos"); 38 | 39 | Optional result = alert.showAndWait(); 40 | if (result.isPresent() && result.get() == ButtonType.OK) { 41 | System.out.println("OK Button Clicked"); 42 | } 43 | } 44 | }); 45 | 46 | root.getChildren().addAll(button); 47 | 48 | scene = new Scene(root, 800, 500); 49 | scene.getStylesheets().add("/com/javacodejunkie/stylesheet.css"); 50 | stage.setTitle("Java Code Junkie - Alert Demo"); 51 | stage.setScene(scene); 52 | } 53 | 54 | public void show() { 55 | this.stage.show(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /AlertDemo/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /AnchorPane Explorer/AnchorPane Explorer.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /AnchorPane Explorer/out/production/AnchorPane Explorer/sample/Controller.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/AnchorPane Explorer/out/production/AnchorPane Explorer/sample/Controller.class -------------------------------------------------------------------------------- /AnchorPane Explorer/out/production/AnchorPane Explorer/sample/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/AnchorPane Explorer/out/production/AnchorPane Explorer/sample/Main.class -------------------------------------------------------------------------------- /AnchorPane Explorer/out/production/AnchorPane Explorer/sample/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-background-color: blue; 3 | } -------------------------------------------------------------------------------- /AnchorPane Explorer/out/production/AnchorPane Explorer/sample/sample.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | -------------------------------------------------------------------------------- /AnchorPane Explorer/src/sample/Controller.java: -------------------------------------------------------------------------------- 1 | package sample; 2 | 3 | public class Controller { 4 | } 5 | -------------------------------------------------------------------------------- /AnchorPane Explorer/src/sample/Main.java: -------------------------------------------------------------------------------- 1 | package sample; 2 | 3 | import javafx.application.Application; 4 | import javafx.scene.Scene; 5 | import javafx.scene.control.Button; 6 | import javafx.scene.control.TextArea; 7 | import javafx.scene.layout.AnchorPane; 8 | import javafx.scene.paint.Color; 9 | import javafx.stage.Stage; 10 | 11 | public class Main extends Application { 12 | 13 | @Override 14 | public void start(Stage primaryStage) throws Exception{ 15 | 16 | primaryStage.setTitle("AnchorPane Explorer"); 17 | 18 | AnchorPane root = new AnchorPane(); 19 | 20 | // Create Controls 21 | TextArea textArea = new TextArea(); 22 | Button button1 = new Button("Open"); 23 | button1.setPrefWidth(75.0); 24 | Button button2 = new Button("Close"); 25 | button2.setPrefWidth(75.0); 26 | 27 | AnchorPane.setTopAnchor(textArea, 10.0); 28 | AnchorPane.setLeftAnchor(textArea, 10.0); 29 | AnchorPane.setRightAnchor(textArea, 100.0); 30 | AnchorPane.setBottomAnchor(textArea, 10.0); 31 | 32 | AnchorPane.setTopAnchor(button1, 10.0); 33 | AnchorPane.setRightAnchor(button1, 10.0); 34 | 35 | AnchorPane.setRightAnchor(button2, 10.0); 36 | AnchorPane.setBottomAnchor(button2, 10.0); 37 | 38 | root.getChildren().addAll(textArea, button1, button2); 39 | 40 | Scene scene = new Scene(root, 450, 250, Color.LIMEGREEN); 41 | primaryStage.setScene(scene); 42 | primaryStage.show(); 43 | } 44 | 45 | 46 | public static void main(String[] args) { 47 | launch(args); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /AnchorPane Explorer/src/sample/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-background-color: blue; 3 | } -------------------------------------------------------------------------------- /AnchorPane Explorer/src/sample/sample.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | -------------------------------------------------------------------------------- /BindingDemo/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BindingDemo/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /BindingDemo/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BindingDemo/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /BindingDemo/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 18px; 3 | } -------------------------------------------------------------------------------- /BindingDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /BindingDemo/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | MainView mainView = new MainView(primaryStage); 11 | mainView.show(); 12 | } 13 | 14 | public static void main(String[] args) { 15 | launch(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BindingDemo/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 18px; 3 | } -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/FXMenu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/FXMenu.class -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/FXStatusBar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/FXStatusBar.class -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/FXToolBar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/FXToolBar.class -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/Person.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/Person.class -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/PersonEvent.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/PersonEvent.class -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/PersonForm$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/PersonForm$1.class -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/PersonForm.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/PersonForm.class -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/PersonTable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/PersonTable.class -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/images/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/images/exit.png -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/images/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/images/open.png -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/images/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/bin/com/javacodejunkie/images/save.png -------------------------------------------------------------------------------- /BorderPaneDemo-3/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14.0px; 3 | } 4 | 5 | #statusbar { 6 | -fx-border-color: -fx-box-border; 7 | -fx-border-width: 1.0; 8 | -fx-border-style: solid; 9 | } 10 | -------------------------------------------------------------------------------- /BorderPaneDemo-3/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/FXMenu.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.scene.control.Menu; 4 | import javafx.scene.control.MenuBar; 5 | import javafx.scene.control.MenuItem; 6 | import javafx.scene.layout.HBox; 7 | import javafx.scene.layout.Priority; 8 | 9 | public class FXMenu extends HBox { 10 | 11 | private MenuBar menuBar; 12 | private Menu fileMenu; 13 | private MenuItem itemOpen; 14 | private MenuItem itemSave; 15 | private MenuItem itemSaveAs; 16 | private Menu editMenu; 17 | private Menu helpMenu; 18 | 19 | public FXMenu() { 20 | buildUI(); 21 | } 22 | 23 | private void buildUI() { 24 | menuBar = new MenuBar(); 25 | fileMenu = new Menu("File"); 26 | itemOpen = new MenuItem("Open"); 27 | itemSave = new MenuItem("Save"); 28 | itemSaveAs = new MenuItem("Save As..."); 29 | fileMenu.getItems().addAll(itemOpen, itemSave, itemSaveAs); 30 | editMenu = new Menu("Edit"); 31 | helpMenu = new Menu("Help"); 32 | menuBar.getMenus().addAll(fileMenu, editMenu, helpMenu); 33 | getChildren().add(menuBar); 34 | HBox.setHgrow(menuBar, Priority.ALWAYS); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/FXStatusBar.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.geometry.Insets; 4 | import javafx.scene.control.Label; 5 | import javafx.scene.layout.HBox; 6 | import javafx.scene.layout.Priority; 7 | 8 | public class FXStatusBar extends HBox { 9 | 10 | private Label label; 11 | 12 | public FXStatusBar() { 13 | this.label = new Label("Ready"); 14 | this.getChildren().add(label); 15 | this.setId("statusbar"); 16 | this.setPadding(new Insets(3)); 17 | HBox.setHgrow(label, Priority.ALWAYS); 18 | } 19 | 20 | public void setText(String text) { 21 | this.label.setText(text); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/FXToolBar.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.scene.control.Button; 4 | import javafx.scene.control.ContentDisplay; 5 | import javafx.scene.control.ToolBar; 6 | import javafx.scene.image.Image; 7 | import javafx.scene.image.ImageView; 8 | import javafx.scene.layout.HBox; 9 | import javafx.scene.layout.Priority; 10 | 11 | public class FXToolBar extends HBox { 12 | 13 | private ToolBar toolBar; 14 | private Button btnOpen; 15 | private Button btnSave; 16 | private Button btnExit; 17 | private ContentDisplay CONTENT_DISPLAY = ContentDisplay.GRAPHIC_ONLY; 18 | 19 | public FXToolBar() { 20 | buildUI(); 21 | } 22 | 23 | private void buildUI() { 24 | btnOpen = createButton("Open", "open.png"); 25 | btnOpen.setContentDisplay(CONTENT_DISPLAY); 26 | btnSave = createButton("Save", "save.png"); 27 | btnSave.setContentDisplay(CONTENT_DISPLAY); 28 | btnExit = createButton("Exit", "exit.png"); 29 | btnExit.setContentDisplay(CONTENT_DISPLAY); 30 | 31 | toolBar = new ToolBar(btnOpen, btnSave, btnExit); 32 | getChildren().add(this.toolBar); 33 | HBox.setHgrow(this.toolBar, Priority.ALWAYS); 34 | } 35 | 36 | public Button createButton(String text, String file) { 37 | String path = "/com/javacodejunkie/images/"; 38 | Image imge = new Image(path + file); 39 | ImageView iview = new ImageView(imge); 40 | iview.setFitHeight(32); 41 | iview.setFitWidth(32); 42 | Button button = new Button(text, iview); 43 | return button; 44 | } 45 | } -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | new MainView(primaryStage); 11 | } 12 | 13 | public static void main(String[] args) { 14 | launch(args); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/MainView.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.scene.Scene; 4 | import javafx.scene.layout.BorderPane; 5 | import javafx.scene.layout.VBox; 6 | import javafx.stage.Stage; 7 | 8 | public class MainView { 9 | 10 | private Stage stage; 11 | private BorderPane root; 12 | private Scene scene; 13 | 14 | private FXMenu fxMenu; 15 | private FXToolBar fxToolBar; 16 | private PersonForm fxForm; 17 | private PersonTable fxTable; 18 | private FXStatusBar fxStatusBar; 19 | 20 | public MainView(Stage stage) { 21 | this.stage = stage; 22 | buildUI(); 23 | } 24 | 25 | private void buildUI() { 26 | 27 | root = new BorderPane(); 28 | root.addEventFilter(PersonEvent.ANY, this::handlePersonEvent); 29 | 30 | fxMenu = new FXMenu(); 31 | fxToolBar = new FXToolBar(); 32 | 33 | VBox top = new VBox(fxMenu, fxToolBar); 34 | root.setTop(top); 35 | 36 | fxForm = new PersonForm(); 37 | root.setLeft(fxForm); 38 | 39 | fxTable = new PersonTable(); 40 | root.setCenter(fxTable); 41 | 42 | fxStatusBar = new FXStatusBar(); 43 | root.setBottom(fxStatusBar); 44 | 45 | scene = new Scene(root, 800, 500); 46 | scene.getStylesheets().add("/com/javacodejunkie/stylesheet.css"); 47 | stage.setTitle("Java Code Junkie - BorderPane Demo 2"); 48 | stage.setScene(scene); 49 | stage.show(); 50 | } 51 | 52 | public void handlePersonEvent(PersonEvent event) { 53 | System.out.println(event.getPerson().getFirstName()+ " " + event.getPerson().getLastName()); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/Person.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | public class Person { 4 | 5 | private String firstName; 6 | private String lastName; 7 | 8 | public Person(String firstName, String lastName) { 9 | this.firstName = firstName; 10 | this.lastName = lastName; 11 | } 12 | 13 | public void setFirstName(String firstName) { 14 | this.firstName = firstName; 15 | } 16 | 17 | public void setLastName(String lastName) { 18 | this.lastName = lastName; 19 | } 20 | 21 | public String getFirstName() { 22 | return firstName; 23 | } 24 | 25 | public String getLastName() { 26 | return lastName; 27 | } 28 | } -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/PersonEvent.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.event.Event; 4 | import javafx.event.EventType; 5 | 6 | public class PersonEvent extends Event { 7 | 8 | private static final long serialVersionUID = -7295215106662000880L; 9 | public static final EventType PERSON = new EventType<>(Event.ANY, "ANY"); 10 | public static final EventType ANY = PERSON; 11 | public static final EventType PERSON_SAVE = new EventType<>(PersonEvent.ANY, "PERSON_SAVE"); 12 | 13 | private Person person; 14 | 15 | public PersonEvent(EventType eventType, Person person) { 16 | super(eventType); 17 | this.person = person; 18 | } 19 | 20 | public Person getPerson() { 21 | return this.person; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/PersonForm.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.event.ActionEvent; 4 | import javafx.event.EventHandler; 5 | import javafx.geometry.Insets; 6 | import javafx.scene.control.Button; 7 | import javafx.scene.control.ButtonBar; 8 | import javafx.scene.control.Label; 9 | import javafx.scene.control.TextField; 10 | import javafx.scene.layout.GridPane; 11 | import javafx.scene.layout.Priority; 12 | import javafx.scene.layout.VBox; 13 | 14 | public class PersonForm extends VBox { 15 | 16 | private GridPane grid; 17 | private Button btnSave; 18 | private Label lblFirstName; 19 | private Label lblLastName; 20 | private TextField txtFirstName; 21 | private TextField txtLastName; 22 | private ButtonBar btnBar; 23 | 24 | public PersonForm() { 25 | grid = new GridPane(); 26 | 27 | lblFirstName = new Label("First Name"); 28 | lblLastName = new Label("Last Name"); 29 | txtFirstName = new TextField(); 30 | txtLastName = new TextField(); 31 | btnSave = new Button("Save"); 32 | btnSave.setOnAction(new EventHandler() { 33 | @Override 34 | public void handle(ActionEvent event) { 35 | Person person = new Person(txtFirstName.getText(), txtLastName.getText()); 36 | btnSave.fireEvent(new PersonEvent(PersonEvent.PERSON_SAVE, person)); 37 | } 38 | }); 39 | 40 | btnBar = new ButtonBar(); 41 | btnBar.getButtons().addAll(btnSave); 42 | 43 | grid.add(lblFirstName, 0, 0, 1, 1); 44 | grid.add(txtFirstName, 1, 0, 1, 1); 45 | grid.add(lblLastName, 0, 1, 1, 1); 46 | grid.add(txtLastName, 1, 1, 1, 1); 47 | grid.add(btnBar, 0, 2, 2, 1); 48 | 49 | grid.setHgap(10); 50 | grid.setVgap(5); 51 | 52 | getChildren().add(grid); 53 | setPadding(new Insets(10)); 54 | VBox.setVgrow(grid, Priority.ALWAYS); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/PersonTable.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.geometry.Insets; 4 | import javafx.scene.control.TableColumn; 5 | import javafx.scene.control.TableView; 6 | import javafx.scene.control.cell.PropertyValueFactory; 7 | import javafx.scene.layout.Priority; 8 | import javafx.scene.layout.VBox; 9 | 10 | public class PersonTable extends VBox { 11 | 12 | private TableView table; 13 | private TableColumn firstNameColumn; 14 | private TableColumn lastNameColumn; 15 | 16 | public PersonTable() { 17 | table = new TableView(); 18 | firstNameColumn = new TableColumn("First Name"); 19 | firstNameColumn.setCellValueFactory(new PropertyValueFactory<>("firstName")); 20 | lastNameColumn = new TableColumn("Last Name"); 21 | lastNameColumn.setCellValueFactory(new PropertyValueFactory<>("lastName")); 22 | table.getColumns().add(firstNameColumn); 23 | table.getColumns().add(lastNameColumn); 24 | table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); 25 | getChildren().add(table); 26 | setPadding(new Insets(10)); 27 | VBox.setVgrow(table, Priority.ALWAYS); 28 | } 29 | 30 | public void addPerson(Person person) { 31 | table.getItems().add(person); 32 | } 33 | 34 | public void removePerson(Person person) { 35 | table.getItems().remove(person); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/images/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/src/com/javacodejunkie/images/exit.png -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/images/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/src/com/javacodejunkie/images/open.png -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/images/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo-3/src/com/javacodejunkie/images/save.png -------------------------------------------------------------------------------- /BorderPaneDemo-3/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14.0px; 3 | } 4 | 5 | #statusbar { 6 | -fx-border-color: -fx-box-border; 7 | -fx-border-width: 1.0; 8 | -fx-border-style: solid; 9 | } 10 | -------------------------------------------------------------------------------- /BorderPaneDemo/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /BorderPaneDemo/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /BorderPaneDemo/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 18px; 3 | -fx-font-weight: bold; 4 | } 5 | 6 | .label { 7 | -fx-font-size: inherit; 8 | -fx-font-weight: inherit; 9 | } 10 | 11 | .button { 12 | -fx-border-color: black; 13 | -fx-border-image-width: 3px; 14 | -fx-border-radius: 3px; 15 | } 16 | 17 | .button:hover { 18 | -fx-background-color: fuchsia; 19 | } -------------------------------------------------------------------------------- /BorderPaneDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /BorderPaneDemo/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | new MainView(primaryStage); 11 | } 12 | 13 | public static void main(String[] args) { 14 | launch(args); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BorderPaneDemo/src/com/javacodejunkie/MainView.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.geometry.Insets; 4 | import javafx.geometry.Pos; 5 | import javafx.scene.Scene; 6 | import javafx.scene.control.Button; 7 | import javafx.scene.layout.BorderPane; 8 | import javafx.stage.Stage; 9 | 10 | public class MainView { 11 | 12 | private Stage stage; 13 | private BorderPane root; 14 | private Scene scene; 15 | private Insets INSETS = new Insets(10, 10, 10, 10); 16 | 17 | public MainView(Stage stage) { 18 | this.stage = stage; 19 | buildUI(); 20 | } 21 | 22 | private void buildUI() { 23 | root = new BorderPane(); 24 | 25 | Button top = createButton("Top"); 26 | Button left = createButton("Left"); 27 | Button center = createButton("Center"); 28 | Button right = createButton("Right"); 29 | Button bottom = createButton("Bottom"); 30 | 31 | root.setTop(top); 32 | root.setLeft(left); 33 | root.setCenter(center); 34 | root.setRight(right); 35 | root.setBottom(bottom); 36 | 37 | scene = new Scene(root); 38 | scene.getStylesheets().add("/com/javacodejunkie/stylesheet.css"); 39 | stage.setTitle("Java Code Junkie - BorderPane Demo"); 40 | stage.setScene(scene); 41 | stage.setMinWidth(550); 42 | stage.setMinHeight(400); 43 | stage.show(); 44 | } 45 | 46 | private Button createButton(String text) { 47 | Button button = new Button(text); 48 | button.setMaxWidth(Double.MAX_VALUE); 49 | button.setMaxHeight(Double.MAX_VALUE); 50 | button.setMinWidth(150); 51 | BorderPane.setMargin(button, INSETS); 52 | BorderPane.setAlignment(button, Pos.CENTER); 53 | return button; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /BorderPaneDemo/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 18px; 3 | -fx-font-weight: bold; 4 | } 5 | 6 | .label { 7 | -fx-font-size: inherit; 8 | -fx-font-weight: inherit; 9 | } 10 | 11 | .button { 12 | -fx-border-color: black; 13 | -fx-border-image-width: 3px; 14 | -fx-border-radius: 3px; 15 | } 16 | 17 | .button:hover { 18 | -fx-background-color: fuchsia; 19 | } -------------------------------------------------------------------------------- /BorderPaneDemo2/bin/com/javacodejunkie/FXForm.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/bin/com/javacodejunkie/FXForm.class -------------------------------------------------------------------------------- /BorderPaneDemo2/bin/com/javacodejunkie/FXMenu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/bin/com/javacodejunkie/FXMenu.class -------------------------------------------------------------------------------- /BorderPaneDemo2/bin/com/javacodejunkie/FXStatusBar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/bin/com/javacodejunkie/FXStatusBar.class -------------------------------------------------------------------------------- /BorderPaneDemo2/bin/com/javacodejunkie/FXTable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/bin/com/javacodejunkie/FXTable.class -------------------------------------------------------------------------------- /BorderPaneDemo2/bin/com/javacodejunkie/FXToolBar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/bin/com/javacodejunkie/FXToolBar.class -------------------------------------------------------------------------------- /BorderPaneDemo2/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /BorderPaneDemo2/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /BorderPaneDemo2/bin/com/javacodejunkie/Person.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/bin/com/javacodejunkie/Person.class -------------------------------------------------------------------------------- /BorderPaneDemo2/bin/com/javacodejunkie/images/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/bin/com/javacodejunkie/images/exit.png -------------------------------------------------------------------------------- /BorderPaneDemo2/bin/com/javacodejunkie/images/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/bin/com/javacodejunkie/images/open.png -------------------------------------------------------------------------------- /BorderPaneDemo2/bin/com/javacodejunkie/images/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/bin/com/javacodejunkie/images/save.png -------------------------------------------------------------------------------- /BorderPaneDemo2/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14.0px; 3 | } 4 | 5 | #statusbar { 6 | -fx-border-color: -fx-box-border; 7 | -fx-border-width: 1.0; 8 | -fx-border-style: solid; 9 | } 10 | -------------------------------------------------------------------------------- /BorderPaneDemo2/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /BorderPaneDemo2/src/com/javacodejunkie/FXForm.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.geometry.Insets; 4 | import javafx.scene.control.Button; 5 | import javafx.scene.control.ButtonBar; 6 | import javafx.scene.control.Label; 7 | import javafx.scene.control.TextField; 8 | import javafx.scene.layout.GridPane; 9 | import javafx.scene.layout.Priority; 10 | import javafx.scene.layout.VBox; 11 | 12 | public class FXForm extends VBox { 13 | 14 | private GridPane grid; 15 | private Button btnSave; 16 | private Label lblFirstName; 17 | private Label lblLastName; 18 | private TextField txtFirstName; 19 | private TextField txtLastName; 20 | private ButtonBar btnBar; 21 | 22 | public FXForm() { 23 | grid = new GridPane(); 24 | 25 | lblFirstName = new Label("First Name"); 26 | lblLastName = new Label("Last Name"); 27 | txtFirstName = new TextField(); 28 | txtLastName = new TextField(); 29 | btnSave = new Button("Save"); 30 | 31 | btnBar = new ButtonBar(); 32 | btnBar.getButtons().addAll(btnSave); 33 | 34 | grid.add(lblFirstName, 0, 0, 1, 1); 35 | grid.add(txtFirstName, 1, 0, 1, 1); 36 | grid.add(lblLastName, 0, 1, 1, 1); 37 | grid.add(txtLastName, 1, 1, 1, 1); 38 | grid.add(btnBar, 0, 2, 2, 1); 39 | 40 | grid.setHgap(10); 41 | grid.setVgap(5); 42 | 43 | getChildren().add(grid); 44 | setPadding(new Insets(10)); 45 | VBox.setVgrow(grid, Priority.ALWAYS); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /BorderPaneDemo2/src/com/javacodejunkie/FXMenu.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.scene.control.Menu; 4 | import javafx.scene.control.MenuBar; 5 | import javafx.scene.control.MenuItem; 6 | import javafx.scene.layout.HBox; 7 | import javafx.scene.layout.Priority; 8 | 9 | public class FXMenu extends HBox { 10 | 11 | private MenuBar menuBar; 12 | private Menu fileMenu; 13 | private MenuItem itemOpen; 14 | private MenuItem itemSave; 15 | private MenuItem itemSaveAs; 16 | private Menu editMenu; 17 | private Menu helpMenu; 18 | 19 | public FXMenu() { 20 | buildUI(); 21 | } 22 | 23 | private void buildUI() { 24 | menuBar = new MenuBar(); 25 | fileMenu = new Menu("File"); 26 | itemOpen = new MenuItem("Open"); 27 | itemSave = new MenuItem("Save"); 28 | itemSaveAs = new MenuItem("Save As..."); 29 | fileMenu.getItems().addAll(itemOpen, itemSave, itemSaveAs); 30 | editMenu = new Menu("Edit"); 31 | helpMenu = new Menu("Help"); 32 | menuBar.getMenus().addAll(fileMenu, editMenu, helpMenu); 33 | getChildren().add(menuBar); 34 | HBox.setHgrow(menuBar, Priority.ALWAYS); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /BorderPaneDemo2/src/com/javacodejunkie/FXStatusBar.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.geometry.Insets; 4 | import javafx.scene.control.Label; 5 | import javafx.scene.layout.HBox; 6 | import javafx.scene.layout.Priority; 7 | 8 | public class FXStatusBar extends HBox { 9 | 10 | private Label label; 11 | 12 | public FXStatusBar() { 13 | this.label = new Label("Ready"); 14 | this.getChildren().add(label); 15 | this.setId("statusbar"); 16 | this.setPadding(new Insets(3)); 17 | HBox.setHgrow(label, Priority.ALWAYS); 18 | } 19 | 20 | public void setText(String text) { 21 | this.label.setText(text); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BorderPaneDemo2/src/com/javacodejunkie/FXTable.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.geometry.Insets; 4 | import javafx.scene.control.TableColumn; 5 | import javafx.scene.control.TableView; 6 | import javafx.scene.layout.Priority; 7 | import javafx.scene.layout.VBox; 8 | 9 | public class FXTable extends VBox { 10 | 11 | private TableView table; 12 | private TableColumn firstNameColumn; 13 | private TableColumn lastNameColumn; 14 | 15 | public FXTable() { 16 | table = new TableView(); 17 | firstNameColumn = new TableColumn("First Name"); 18 | lastNameColumn = new TableColumn("Last Name"); 19 | table.getColumns().add(firstNameColumn); 20 | table.getColumns().add(lastNameColumn); 21 | table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); 22 | getChildren().add(table); 23 | setPadding(new Insets(10)); 24 | VBox.setVgrow(table, Priority.ALWAYS); 25 | } 26 | 27 | public void addPerson(Person person) { 28 | table.getItems().add(person); 29 | } 30 | 31 | public void removePerson(Person person) { 32 | table.getItems().remove(person); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /BorderPaneDemo2/src/com/javacodejunkie/FXToolBar.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.scene.control.Button; 4 | import javafx.scene.control.ContentDisplay; 5 | import javafx.scene.control.ToolBar; 6 | import javafx.scene.image.Image; 7 | import javafx.scene.image.ImageView; 8 | import javafx.scene.layout.HBox; 9 | import javafx.scene.layout.Priority; 10 | 11 | public class FXToolBar extends HBox { 12 | 13 | private ToolBar toolBar; 14 | private Button btnOpen; 15 | private Button btnSave; 16 | private Button btnExit; 17 | private ContentDisplay CONTENT_DISPLAY = ContentDisplay.GRAPHIC_ONLY; 18 | 19 | public FXToolBar() { 20 | buildUI(); 21 | } 22 | 23 | private void buildUI() { 24 | btnOpen = createButton("Open", "open.png"); 25 | btnOpen.setContentDisplay(CONTENT_DISPLAY); 26 | btnSave = createButton("Save", "save.png"); 27 | btnSave.setContentDisplay(CONTENT_DISPLAY); 28 | btnExit = createButton("Exit", "exit.png"); 29 | btnExit.setContentDisplay(CONTENT_DISPLAY); 30 | 31 | toolBar = new ToolBar(btnOpen, btnSave, btnExit); 32 | getChildren().add(this.toolBar); 33 | HBox.setHgrow(this.toolBar, Priority.ALWAYS); 34 | } 35 | 36 | public Button createButton(String text, String file) { 37 | String path = "/com/javacodejunkie/images/"; 38 | Image imge = new Image(path + file); 39 | ImageView iview = new ImageView(imge); 40 | iview.setFitHeight(32); 41 | iview.setFitWidth(32); 42 | Button button = new Button(text, iview); 43 | return button; 44 | } 45 | } -------------------------------------------------------------------------------- /BorderPaneDemo2/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | new MainView(primaryStage); 11 | } 12 | 13 | public static void main(String[] args) { 14 | launch(args); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BorderPaneDemo2/src/com/javacodejunkie/MainView.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.scene.Scene; 4 | import javafx.scene.layout.BorderPane; 5 | import javafx.scene.layout.VBox; 6 | import javafx.stage.Stage; 7 | 8 | public class MainView { 9 | 10 | private Stage stage; 11 | private BorderPane root; 12 | private Scene scene; 13 | 14 | private FXMenu fxMenu; 15 | private FXToolBar fxToolBar; 16 | private FXForm fxForm; 17 | private FXTable fxTable; 18 | private FXStatusBar fxStatusBar; 19 | 20 | public MainView(Stage stage) { 21 | this.stage = stage; 22 | buildUI(); 23 | } 24 | 25 | private void buildUI() { 26 | 27 | root = new BorderPane(); 28 | 29 | fxMenu = new FXMenu(); 30 | fxToolBar = new FXToolBar(); 31 | 32 | VBox top = new VBox(fxMenu, fxToolBar); 33 | root.setTop(top); 34 | 35 | fxForm = new FXForm(); 36 | root.setLeft(fxForm); 37 | 38 | fxTable = new FXTable(); 39 | root.setCenter(fxTable); 40 | 41 | fxStatusBar = new FXStatusBar(); 42 | root.setBottom(fxStatusBar); 43 | 44 | scene = new Scene(root, 800, 500); 45 | scene.getStylesheets().add("/com/javacodejunkie/stylesheet.css"); 46 | stage.setTitle("Java Code Junkie - BorderPane Demo 2"); 47 | stage.setScene(scene); 48 | stage.show(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /BorderPaneDemo2/src/com/javacodejunkie/Person.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | public class Person { 4 | 5 | private String firstName; 6 | private String lastName; 7 | 8 | public Person(String firstName, String lastName) { 9 | this.firstName = firstName; 10 | this.lastName = lastName; 11 | } 12 | 13 | public void setFirstName(String firstName) { 14 | this.firstName = firstName; 15 | } 16 | 17 | public void setLastName(String lastName) { 18 | this.lastName = lastName; 19 | } 20 | 21 | public String getFirstName() { 22 | return firstName; 23 | } 24 | 25 | public String getLastName() { 26 | return lastName; 27 | } 28 | } -------------------------------------------------------------------------------- /BorderPaneDemo2/src/com/javacodejunkie/images/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/src/com/javacodejunkie/images/exit.png -------------------------------------------------------------------------------- /BorderPaneDemo2/src/com/javacodejunkie/images/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/src/com/javacodejunkie/images/open.png -------------------------------------------------------------------------------- /BorderPaneDemo2/src/com/javacodejunkie/images/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/BorderPaneDemo2/src/com/javacodejunkie/images/save.png -------------------------------------------------------------------------------- /BorderPaneDemo2/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14.0px; 3 | } 4 | 5 | #statusbar { 6 | -fx-border-color: -fx-box-border; 7 | -fx-border-width: 1.0; 8 | -fx-border-style: solid; 9 | } 10 | -------------------------------------------------------------------------------- /ButtonBarDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ButtonBarDemo/bin/application/Main.class -------------------------------------------------------------------------------- /ButtonBarDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /ButtonBarDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ButtonBarDemo/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.geometry.Insets; 5 | import javafx.geometry.Pos; 6 | import javafx.scene.Scene; 7 | import javafx.scene.control.Button; 8 | import javafx.scene.control.ButtonBar; 9 | import javafx.scene.control.ButtonBar.ButtonData; 10 | import javafx.scene.control.Separator; 11 | import javafx.scene.layout.BorderPane; 12 | import javafx.scene.layout.VBox; 13 | import javafx.stage.Stage; 14 | 15 | public class Main extends Application { 16 | @Override 17 | public void start(Stage primaryStage) { 18 | try { 19 | BorderPane root = new BorderPane(); 20 | 21 | ButtonBar buttonBar = new ButtonBar(); 22 | buttonBar.setPadding(new Insets(10)); 23 | 24 | Button btnYes = new Button("Yes"); 25 | ButtonBar.setButtonData(btnYes, ButtonData.LEFT); 26 | 27 | Button btnNo = new Button("No"); 28 | ButtonBar.setButtonData(btnNo, ButtonData.RIGHT); 29 | 30 | buttonBar.getButtons().addAll(btnYes, btnNo); 31 | 32 | //buttonBar.setButtonOrder("NY"); 33 | 34 | root.setBottom(buttonBar); 35 | 36 | Scene scene = new Scene(root, 400, 200); 37 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 38 | primaryStage.setScene(scene); 39 | primaryStage.setTitle("ButtonBar Demo"); 40 | primaryStage.show(); 41 | } catch (Exception e) { 42 | e.printStackTrace(); 43 | } 44 | } 45 | 46 | public static void main(String[] args) { 47 | launch(args); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ButtonBarDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /ButtonExplorer/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ButtonExplorer/bin/application/Main.class -------------------------------------------------------------------------------- /ButtonExplorer/bin/application/SaveButtonHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ButtonExplorer/bin/application/SaveButtonHandler.class -------------------------------------------------------------------------------- /ButtonExplorer/bin/application/SaveEvent.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ButtonExplorer/bin/application/SaveEvent.class -------------------------------------------------------------------------------- /ButtonExplorer/bin/application/SaveEventHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ButtonExplorer/bin/application/SaveEventHandler.class -------------------------------------------------------------------------------- /ButtonExplorer/bin/application/Sphere3D.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ButtonExplorer/bin/application/Sphere3D.class -------------------------------------------------------------------------------- /ButtonExplorer/bin/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font: 18px "Roboto"; 3 | -fx-background-color: #b0c4de; 4 | } 5 | -------------------------------------------------------------------------------- /ButtonExplorer/bin/application/ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ButtonExplorer/bin/application/ok.png -------------------------------------------------------------------------------- /ButtonExplorer/bin/application/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ButtonExplorer/bin/application/save.png -------------------------------------------------------------------------------- /ButtonExplorer/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ButtonExplorer/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.event.ActionEvent; 5 | import javafx.event.EventHandler; 6 | import javafx.scene.Scene; 7 | import javafx.scene.control.Button; 8 | import javafx.scene.image.Image; 9 | import javafx.scene.image.ImageView; 10 | import javafx.scene.layout.BorderPane; 11 | import javafx.scene.text.Font; 12 | import javafx.stage.Stage; 13 | 14 | class SaveButtonHandler implements EventHandler { 15 | 16 | @Override 17 | public void handle(ActionEvent event) { 18 | System.out.println("Save button clicked"); 19 | } 20 | } 21 | 22 | public class Main extends Application { 23 | @Override 24 | public void start(Stage primaryStage) { 25 | try { 26 | BorderPane root = new BorderPane(); 27 | 28 | Image image = new Image(getClass().getResourceAsStream("save.png")); 29 | ImageView iview = new ImageView(image); 30 | Button button = new Button("_Save", iview); 31 | 32 | button.setOnAction(new SaveButtonHandler()); 33 | //button.setOnAction(event -> System.out.println("Save button clicked")); 34 | 35 | //button.setFont(new Font("Roboto", 18)); 36 | 37 | //button.setRotate(270); 38 | 39 | root.setCenter(button); 40 | 41 | Scene scene = new Scene(root, 800, 600); 42 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 43 | primaryStage.setScene(scene); 44 | primaryStage.setTitle("Button Explorer"); 45 | primaryStage.show(); 46 | } catch (Exception e) { 47 | e.printStackTrace(); 48 | } 49 | } 50 | 51 | public static void main(String[] args) { 52 | launch(args); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ButtonExplorer/src/application/SaveEvent.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.event.Event; 4 | import javafx.event.EventTarget; 5 | import javafx.event.EventType; 6 | 7 | public class SaveEvent extends Event { 8 | 9 | private static final long serialVersionUID = 20121107L; 10 | 11 | public static final EventType SAVE = new EventType(Event.ANY, "SAVE"); 12 | 13 | public static final EventType ANY = SAVE; 14 | 15 | public SaveEvent() { 16 | super(SAVE); 17 | } 18 | 19 | public SaveEvent(Object source, EventTarget target) { 20 | super(source, target, SAVE); 21 | } 22 | 23 | @Override 24 | public SaveEvent copyFor(Object newSource, EventTarget newTarget) { 25 | return (SaveEvent) super.copyFor(newSource, newTarget); 26 | } 27 | 28 | @SuppressWarnings("unchecked") 29 | @Override 30 | public EventType getEventType() { 31 | return (EventType) super.getEventType(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ButtonExplorer/src/application/SaveEventHandler.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.event.ActionEvent; 4 | import javafx.event.EventHandler; 5 | import javafx.event.EventTarget; 6 | 7 | public class SaveEventHandler implements EventHandler { 8 | 9 | private Object source; 10 | private EventTarget target; 11 | 12 | public SaveEventHandler(Object source, EventTarget target) { 13 | 14 | } 15 | 16 | @Override 17 | public void handle(SaveEvent event) { 18 | ActionEvent aevent = new ActionEvent(source, target); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ButtonExplorer/src/application/Sphere3D.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.scene.Camera; 5 | import javafx.scene.Group; 6 | import javafx.scene.PerspectiveCamera; 7 | import javafx.scene.Scene; 8 | import javafx.scene.input.KeyEvent; 9 | import javafx.scene.paint.Color; 10 | import javafx.scene.shape.Sphere; 11 | import javafx.stage.Stage; 12 | 13 | public class Sphere3D extends Application { 14 | 15 | private static final int WIDTH = 1400; 16 | private static final int HEIGHT = 800; 17 | 18 | @Override 19 | public void start(Stage primaryStage) throws Exception { 20 | Sphere sphere = new Sphere(50); 21 | 22 | Group group = new Group(); 23 | group.getChildren().add(sphere); 24 | 25 | Camera camera = new PerspectiveCamera(); 26 | Scene scene = new Scene(group, WIDTH, HEIGHT); 27 | scene.setFill(Color.LAWNGREEN); 28 | scene.setCamera(camera); 29 | 30 | sphere.translateXProperty().set(WIDTH / 2); 31 | sphere.translateYProperty().set(HEIGHT / 2); 32 | 33 | primaryStage.addEventHandler(KeyEvent.KEY_PRESSED, event -> { 34 | switch (event.getCode()) { 35 | case W: 36 | sphere.translateZProperty().set(sphere.getTranslateZ() + 100); 37 | break; 38 | case S: 39 | sphere.translateZProperty().set(sphere.getTranslateZ() - 100); 40 | break; 41 | default: 42 | break; 43 | } 44 | }); 45 | 46 | primaryStage.setTitle("Genuine Coder"); 47 | primaryStage.setScene(scene); 48 | primaryStage.show(); 49 | } 50 | 51 | public static void main(String[] args) { 52 | launch(args); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ButtonExplorer/src/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font: 18px "Roboto"; 3 | -fx-background-color: #b0c4de; 4 | } 5 | -------------------------------------------------------------------------------- /ButtonExplorer/src/application/ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ButtonExplorer/src/application/ok.png -------------------------------------------------------------------------------- /ButtonExplorer/src/application/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ButtonExplorer/src/application/save.png -------------------------------------------------------------------------------- /ChangeListenerDemo/bin/application/FXUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ChangeListenerDemo/bin/application/FXUtils.class -------------------------------------------------------------------------------- /ChangeListenerDemo/bin/application/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ChangeListenerDemo/bin/application/Main$1.class -------------------------------------------------------------------------------- /ChangeListenerDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ChangeListenerDemo/bin/application/Main.class -------------------------------------------------------------------------------- /ChangeListenerDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 16px; 3 | } 4 | -------------------------------------------------------------------------------- /ChangeListenerDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ChangeListenerDemo/src/application/FXUtils.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import java.io.FileInputStream; 4 | import java.io.FileNotFoundException; 5 | 6 | import javafx.geometry.Insets; 7 | import javafx.geometry.Pos; 8 | import javafx.scene.Node; 9 | import javafx.scene.control.Button; 10 | import javafx.scene.image.Image; 11 | import javafx.scene.image.ImageView; 12 | import javafx.scene.layout.HBox; 13 | import javafx.scene.layout.VBox; 14 | 15 | public class FXUtils { 16 | 17 | public static HBox createHBox(Node... children) { 18 | HBox hbox = new HBox(children); 19 | hbox.setAlignment(Pos.BASELINE_CENTER); 20 | hbox.setPadding(new Insets(10)); 21 | hbox.setSpacing(10); 22 | 23 | return hbox; 24 | } 25 | 26 | public static VBox createVBox(Node... children) { 27 | VBox vbox = new VBox(children); 28 | vbox.setAlignment(Pos.BASELINE_CENTER); 29 | vbox.setPadding(new Insets(10)); 30 | vbox.setSpacing(10); 31 | 32 | return vbox; 33 | } 34 | 35 | public static Button createButton(String text) { 36 | Button button = new Button(text); 37 | return button; 38 | } 39 | 40 | public static Button createButtonWithIcon(String text, String url) throws FileNotFoundException { 41 | Button button = new Button(); 42 | FileInputStream input = new FileInputStream(url); 43 | Image image = new Image(input); 44 | ImageView imageView = new ImageView(image); 45 | button.setText(text); 46 | button.setGraphic(imageView); 47 | return button; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ChangeListenerDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 16px; 3 | } 4 | -------------------------------------------------------------------------------- /CheckBox Demo/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CheckBox Demo/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /CheckBox Demo/bin/com/javacodejunkie/MainView$CheckBoxHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CheckBox Demo/bin/com/javacodejunkie/MainView$CheckBoxHandler.class -------------------------------------------------------------------------------- /CheckBox Demo/bin/com/javacodejunkie/MainView$ExpandedPropertyListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CheckBox Demo/bin/com/javacodejunkie/MainView$ExpandedPropertyListener.class -------------------------------------------------------------------------------- /CheckBox Demo/bin/com/javacodejunkie/MainView$TitledPaneHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CheckBox Demo/bin/com/javacodejunkie/MainView$TitledPaneHandler.class -------------------------------------------------------------------------------- /CheckBox Demo/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CheckBox Demo/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /CheckBox Demo/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 18px; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /CheckBox Demo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CheckBox Demo/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | MainView mainView = new MainView(primaryStage); 11 | mainView.show(); 12 | } 13 | 14 | public static void main(String[] args) { 15 | launch(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CheckBox Demo/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 18px; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /ComboBoxDemo/bin/application/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ComboBoxDemo/bin/application/Main$1.class -------------------------------------------------------------------------------- /ComboBoxDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ComboBoxDemo/bin/application/Main.class -------------------------------------------------------------------------------- /ComboBoxDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size:0.0 18px; 3 | } -------------------------------------------------------------------------------- /ComboBoxDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ComboBoxDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size:0.0 18px; 3 | } -------------------------------------------------------------------------------- /CreateStage/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CreateStage/bin/application/Main.class -------------------------------------------------------------------------------- /CreateStage/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /CreateStage/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CreateStage/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | import javafx.scene.Scene; 6 | import javafx.scene.layout.BorderPane; 7 | 8 | 9 | public class Main extends Application { 10 | @Override 11 | public void start(Stage primaryStage) { 12 | try { 13 | BorderPane root = new BorderPane(); 14 | 15 | Stage stage = new Stage(); 16 | 17 | 18 | 19 | primaryStage.setScene(scene); 20 | primaryStage.show(); 21 | } catch(Exception e) { 22 | e.printStackTrace(); 23 | } 24 | } 25 | 26 | public static void main(String[] args) { 27 | launch(args); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /CreateStage/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/FXMenu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/FXMenu.class -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/FXStatusBar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/FXStatusBar.class -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/FXToolBar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/FXToolBar.class -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/Person.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/Person.class -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/PersonEvent.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/PersonEvent.class -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/PersonForm$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/PersonForm$1.class -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/PersonForm.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/PersonForm.class -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/PersonTable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/PersonTable.class -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/images/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/images/exit.png -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/images/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/images/open.png -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/images/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/bin/com/javacodejunkie/images/save.png -------------------------------------------------------------------------------- /CustomEvents-1/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14.0px; 3 | } 4 | 5 | #statusbar { 6 | -fx-border-color: -fx-box-border; 7 | -fx-border-width: 1.0; 8 | -fx-border-style: solid; 9 | } 10 | -------------------------------------------------------------------------------- /CustomEvents-1/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/FXMenu.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.scene.control.Menu; 4 | import javafx.scene.control.MenuBar; 5 | import javafx.scene.control.MenuItem; 6 | import javafx.scene.layout.HBox; 7 | import javafx.scene.layout.Priority; 8 | 9 | public class FXMenu extends HBox { 10 | 11 | private MenuBar menuBar; 12 | private Menu fileMenu; 13 | private MenuItem itemOpen; 14 | private MenuItem itemSave; 15 | private MenuItem itemSaveAs; 16 | private Menu editMenu; 17 | private Menu helpMenu; 18 | 19 | public FXMenu() { 20 | buildUI(); 21 | } 22 | 23 | private void buildUI() { 24 | menuBar = new MenuBar(); 25 | fileMenu = new Menu("File"); 26 | itemOpen = new MenuItem("Open"); 27 | itemSave = new MenuItem("Save"); 28 | itemSaveAs = new MenuItem("Save As..."); 29 | fileMenu.getItems().addAll(itemOpen, itemSave, itemSaveAs); 30 | editMenu = new Menu("Edit"); 31 | helpMenu = new Menu("Help"); 32 | menuBar.getMenus().addAll(fileMenu, editMenu, helpMenu); 33 | getChildren().add(menuBar); 34 | HBox.setHgrow(menuBar, Priority.ALWAYS); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/FXStatusBar.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.geometry.Insets; 4 | import javafx.scene.control.Label; 5 | import javafx.scene.layout.HBox; 6 | import javafx.scene.layout.Priority; 7 | 8 | public class FXStatusBar extends HBox { 9 | 10 | private Label label; 11 | 12 | public FXStatusBar() { 13 | this.label = new Label("Ready"); 14 | this.getChildren().add(label); 15 | this.setId("statusbar"); 16 | this.setPadding(new Insets(3)); 17 | HBox.setHgrow(label, Priority.ALWAYS); 18 | } 19 | 20 | public void setText(String text) { 21 | this.label.setText(text); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/FXToolBar.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.scene.control.Button; 4 | import javafx.scene.control.ContentDisplay; 5 | import javafx.scene.control.ToolBar; 6 | import javafx.scene.image.Image; 7 | import javafx.scene.image.ImageView; 8 | import javafx.scene.layout.HBox; 9 | import javafx.scene.layout.Priority; 10 | 11 | public class FXToolBar extends HBox { 12 | 13 | private ToolBar toolBar; 14 | private Button btnOpen; 15 | private Button btnSave; 16 | private Button btnExit; 17 | private ContentDisplay CONTENT_DISPLAY = ContentDisplay.GRAPHIC_ONLY; 18 | 19 | public FXToolBar() { 20 | buildUI(); 21 | } 22 | 23 | private void buildUI() { 24 | btnOpen = createButton("Open", "open.png"); 25 | btnOpen.setContentDisplay(CONTENT_DISPLAY); 26 | btnSave = createButton("Save", "save.png"); 27 | btnSave.setContentDisplay(CONTENT_DISPLAY); 28 | btnExit = createButton("Exit", "exit.png"); 29 | btnExit.setContentDisplay(CONTENT_DISPLAY); 30 | 31 | toolBar = new ToolBar(btnOpen, btnSave, btnExit); 32 | getChildren().add(this.toolBar); 33 | HBox.setHgrow(this.toolBar, Priority.ALWAYS); 34 | } 35 | 36 | public Button createButton(String text, String file) { 37 | String path = "/com/javacodejunkie/images/"; 38 | Image imge = new Image(path + file); 39 | ImageView iview = new ImageView(imge); 40 | iview.setFitHeight(32); 41 | iview.setFitWidth(32); 42 | Button button = new Button(text, iview); 43 | return button; 44 | } 45 | } -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | new MainView(primaryStage); 11 | } 12 | 13 | public static void main(String[] args) { 14 | launch(args); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/MainView.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.scene.Scene; 4 | import javafx.scene.layout.BorderPane; 5 | import javafx.scene.layout.VBox; 6 | import javafx.stage.Stage; 7 | 8 | public class MainView { 9 | 10 | private Stage stage; 11 | private BorderPane root; 12 | private Scene scene; 13 | 14 | private FXMenu fxMenu; 15 | private FXToolBar fxToolBar; 16 | private PersonForm fxForm; 17 | private PersonTable fxTable; 18 | private FXStatusBar fxStatusBar; 19 | 20 | public MainView(Stage stage) { 21 | this.stage = stage; 22 | buildUI(); 23 | } 24 | 25 | private void buildUI() { 26 | 27 | root = new BorderPane(); 28 | root.addEventFilter(PersonEvent.ANY, this::handlePersonEvent); 29 | 30 | fxMenu = new FXMenu(); 31 | fxToolBar = new FXToolBar(); 32 | 33 | VBox top = new VBox(fxMenu, fxToolBar); 34 | root.setTop(top); 35 | 36 | fxForm = new PersonForm(); 37 | root.setLeft(fxForm); 38 | 39 | fxTable = new PersonTable(); 40 | root.setCenter(fxTable); 41 | 42 | fxStatusBar = new FXStatusBar(); 43 | root.setBottom(fxStatusBar); 44 | 45 | scene = new Scene(root, 800, 500); 46 | scene.getStylesheets().add("/com/javacodejunkie/stylesheet.css"); 47 | stage.setTitle("Java Code Junkie - BorderPane Demo 2"); 48 | stage.setScene(scene); 49 | stage.show(); 50 | } 51 | 52 | public void handlePersonEvent(PersonEvent event) { 53 | System.out.println(event.getPerson().getFirstName()+ " " + event.getPerson().getLastName()); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/Person.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | public class Person { 4 | 5 | private String firstName; 6 | private String lastName; 7 | 8 | public Person(String firstName, String lastName) { 9 | this.firstName = firstName; 10 | this.lastName = lastName; 11 | } 12 | 13 | public void setFirstName(String firstName) { 14 | this.firstName = firstName; 15 | } 16 | 17 | public void setLastName(String lastName) { 18 | this.lastName = lastName; 19 | } 20 | 21 | public String getFirstName() { 22 | return firstName; 23 | } 24 | 25 | public String getLastName() { 26 | return lastName; 27 | } 28 | } -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/PersonEvent.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.event.Event; 4 | import javafx.event.EventType; 5 | 6 | public class PersonEvent extends Event { 7 | 8 | private static final long serialVersionUID = -7295215106662000880L; 9 | public static final EventType PERSON = new EventType<>(Event.ANY, "ANY"); 10 | public static final EventType ANY = PERSON; 11 | public static final EventType PERSON_SAVE = new EventType<>(PersonEvent.ANY, "PERSON_SAVE"); 12 | 13 | private Person person; 14 | 15 | public PersonEvent(EventType eventType, Person person) { 16 | super(eventType); 17 | this.person = person; 18 | } 19 | 20 | public Person getPerson() { 21 | return this.person; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/PersonForm.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.event.ActionEvent; 4 | import javafx.event.EventHandler; 5 | import javafx.geometry.Insets; 6 | import javafx.scene.control.Button; 7 | import javafx.scene.control.ButtonBar; 8 | import javafx.scene.control.Label; 9 | import javafx.scene.control.TextField; 10 | import javafx.scene.layout.GridPane; 11 | import javafx.scene.layout.Priority; 12 | import javafx.scene.layout.VBox; 13 | 14 | public class PersonForm extends VBox { 15 | 16 | private GridPane grid; 17 | private Button btnSave; 18 | private Label lblFirstName; 19 | private Label lblLastName; 20 | private TextField txtFirstName; 21 | private TextField txtLastName; 22 | private ButtonBar btnBar; 23 | 24 | public PersonForm() { 25 | grid = new GridPane(); 26 | 27 | lblFirstName = new Label("First Name"); 28 | lblLastName = new Label("Last Name"); 29 | txtFirstName = new TextField(); 30 | txtLastName = new TextField(); 31 | btnSave = new Button("Save"); 32 | btnSave.setOnAction(new EventHandler() { 33 | @Override 34 | public void handle(ActionEvent event) { 35 | Person person = new Person(txtFirstName.getText(), txtLastName.getText()); 36 | btnSave.fireEvent(new PersonEvent(PersonEvent.PERSON_SAVE, person)); 37 | } 38 | }); 39 | 40 | btnBar = new ButtonBar(); 41 | btnBar.getButtons().addAll(btnSave); 42 | 43 | grid.add(lblFirstName, 0, 0, 1, 1); 44 | grid.add(txtFirstName, 1, 0, 1, 1); 45 | grid.add(lblLastName, 0, 1, 1, 1); 46 | grid.add(txtLastName, 1, 1, 1, 1); 47 | grid.add(btnBar, 0, 2, 2, 1); 48 | 49 | grid.setHgap(10); 50 | grid.setVgap(5); 51 | 52 | getChildren().add(grid); 53 | setPadding(new Insets(10)); 54 | VBox.setVgrow(grid, Priority.ALWAYS); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/PersonTable.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.geometry.Insets; 4 | import javafx.scene.control.TableColumn; 5 | import javafx.scene.control.TableView; 6 | import javafx.scene.control.cell.PropertyValueFactory; 7 | import javafx.scene.layout.Priority; 8 | import javafx.scene.layout.VBox; 9 | 10 | public class PersonTable extends VBox { 11 | 12 | private TableView table; 13 | private TableColumn firstNameColumn; 14 | private TableColumn lastNameColumn; 15 | 16 | public PersonTable() { 17 | table = new TableView(); 18 | firstNameColumn = new TableColumn("First Name"); 19 | firstNameColumn.setCellValueFactory(new PropertyValueFactory<>("firstName")); 20 | lastNameColumn = new TableColumn("Last Name"); 21 | lastNameColumn.setCellValueFactory(new PropertyValueFactory<>("lastName")); 22 | table.getColumns().add(firstNameColumn); 23 | table.getColumns().add(lastNameColumn); 24 | table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); 25 | getChildren().add(table); 26 | setPadding(new Insets(10)); 27 | VBox.setVgrow(table, Priority.ALWAYS); 28 | } 29 | 30 | public void addPerson(Person person) { 31 | table.getItems().add(person); 32 | } 33 | 34 | public void removePerson(Person person) { 35 | table.getItems().remove(person); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/images/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/src/com/javacodejunkie/images/exit.png -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/images/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/src/com/javacodejunkie/images/open.png -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/images/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/CustomEvents-1/src/com/javacodejunkie/images/save.png -------------------------------------------------------------------------------- /CustomEvents-1/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14.0px; 3 | } 4 | 5 | #statusbar { 6 | -fx-border-color: -fx-box-border; 7 | -fx-border-width: 1.0; 8 | -fx-border-style: solid; 9 | } 10 | -------------------------------------------------------------------------------- /DatePickerDemo/bin/application/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/DatePickerDemo/bin/application/Main$1.class -------------------------------------------------------------------------------- /DatePickerDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/DatePickerDemo/bin/application/Main.class -------------------------------------------------------------------------------- /DatePickerDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /DatePickerDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DatePickerDemo/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import java.time.LocalDate; 4 | 5 | import javafx.application.Application; 6 | import javafx.event.ActionEvent; 7 | import javafx.event.EventHandler; 8 | import javafx.scene.Scene; 9 | import javafx.scene.control.DatePicker; 10 | import javafx.scene.layout.BorderPane; 11 | import javafx.stage.Stage; 12 | 13 | 14 | public class Main extends Application { 15 | @Override 16 | public void start(Stage primaryStage) { 17 | try { 18 | primaryStage.setTitle("DatePicker Demo"); 19 | BorderPane root = new BorderPane(); 20 | 21 | DatePicker datePicker = new DatePicker(); 22 | 23 | datePicker.setOnAction(new EventHandler() { 24 | @Override 25 | public void handle(ActionEvent event) { 26 | System.out.println("You have selected the date: " + datePicker.getValue()); 27 | } 28 | }); 29 | 30 | //datePicker.setValue(LocalDate.now()); 31 | datePicker.setValue(LocalDate.of(1955, 04, 15)); 32 | 33 | datePicker.getEditor().clear(); 34 | datePicker.setValue(null); 35 | 36 | root.setTop(datePicker); 37 | 38 | Scene scene = new Scene(root,600,400); 39 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 40 | primaryStage.setScene(scene); 41 | primaryStage.show(); 42 | } catch(Exception e) { 43 | e.printStackTrace(); 44 | } 45 | } 46 | 47 | public static void main(String[] args) { 48 | launch(args); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /DatePickerDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /DialogDemo/bin/application/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/DialogDemo/bin/application/Main$1.class -------------------------------------------------------------------------------- /DialogDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/DialogDemo/bin/application/Main.class -------------------------------------------------------------------------------- /DialogDemo/bin/application/Person.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/DialogDemo/bin/application/Person.class -------------------------------------------------------------------------------- /DialogDemo/bin/application/PersonDialog$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/DialogDemo/bin/application/PersonDialog$1.class -------------------------------------------------------------------------------- /DialogDemo/bin/application/PersonDialog$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/DialogDemo/bin/application/PersonDialog$2.class -------------------------------------------------------------------------------- /DialogDemo/bin/application/PersonDialog.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/DialogDemo/bin/application/PersonDialog.class -------------------------------------------------------------------------------- /DialogDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 18px; 3 | } 4 | -------------------------------------------------------------------------------- /DialogDemo/bin/application/dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/DialogDemo/bin/application/dial.png -------------------------------------------------------------------------------- /DialogDemo/bin/application/person.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/DialogDemo/bin/application/person.png -------------------------------------------------------------------------------- /DialogDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DialogDemo/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import java.util.Optional; 4 | 5 | import javafx.application.Application; 6 | import javafx.event.ActionEvent; 7 | import javafx.event.EventHandler; 8 | import javafx.geometry.Insets; 9 | import javafx.geometry.Pos; 10 | import javafx.scene.Scene; 11 | import javafx.scene.control.Button; 12 | import javafx.scene.control.Dialog; 13 | import javafx.scene.control.ListView; 14 | import javafx.scene.layout.BorderPane; 15 | import javafx.scene.layout.VBox; 16 | import javafx.stage.Stage; 17 | 18 | public class Main extends Application { 19 | 20 | private Button addButton = new Button("Add Person"); 21 | private ListView listView = new ListView<>(); 22 | 23 | @Override 24 | public void start(Stage primaryStage) { 25 | try { 26 | primaryStage.setTitle("Dialog Demo"); 27 | BorderPane root = new BorderPane(); 28 | 29 | addButton.setOnAction(new EventHandler() { 30 | @Override 31 | public void handle(ActionEvent event) { 32 | Dialog personDialog = new PersonDialog(new Person("", "")); 33 | Optional result = personDialog.showAndWait(); 34 | if (result.isPresent()) { 35 | Person person = result.get(); 36 | listView.getItems().add(person.getFirstName() + " " + person.getLastName()); 37 | } 38 | } 39 | }); 40 | 41 | VBox vbox = new VBox(10); 42 | vbox.setAlignment(Pos.CENTER); 43 | vbox.setPadding(new Insets(10)); 44 | vbox.getChildren().addAll(addButton, listView); 45 | root.setCenter(vbox); 46 | 47 | Scene scene = new Scene(root, 400, 400); 48 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 49 | primaryStage.setScene(scene); 50 | 51 | primaryStage.show(); 52 | } catch (Exception e) { 53 | e.printStackTrace(); 54 | } 55 | } 56 | 57 | public static void main(String[] args) { 58 | launch(args); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /DialogDemo/src/application/Person.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.beans.property.SimpleStringProperty; 4 | import javafx.beans.property.StringProperty; 5 | 6 | public class Person { 7 | 8 | private StringProperty firstName; 9 | private StringProperty lastName; 10 | 11 | public Person(String firstName, String lastName) { 12 | this.firstName = new SimpleStringProperty(firstName); 13 | this.lastName = new SimpleStringProperty(lastName); 14 | } 15 | 16 | public StringProperty firstNameProperty() { 17 | return firstName; 18 | } 19 | 20 | public String getFirstName() { 21 | return firstName.get(); 22 | } 23 | 24 | public void setFirstName(String firstName) { 25 | this.firstName.set(firstName); 26 | } 27 | 28 | public StringProperty lastNameProperty() { 29 | return lastName; 30 | }; 31 | 32 | public String getLastName() { 33 | return lastName.get(); 34 | } 35 | 36 | public void setLastName(String lastName) { 37 | this.lastName.set(lastName); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /DialogDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 18px; 3 | } 4 | -------------------------------------------------------------------------------- /DialogDemo/src/application/dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/DialogDemo/src/application/dial.png -------------------------------------------------------------------------------- /DialogDemo/src/application/person.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/DialogDemo/src/application/person.png -------------------------------------------------------------------------------- /EventExplorer/bin/application/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/EventExplorer/bin/application/Main$1.class -------------------------------------------------------------------------------- /EventExplorer/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/EventExplorer/bin/application/Main.class -------------------------------------------------------------------------------- /EventExplorer/bin/application/MyEventHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/EventExplorer/bin/application/MyEventHandler.class -------------------------------------------------------------------------------- /EventExplorer/bin/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-family: 'JetBrains Mono'; 3 | -fx-font-size: 18.0; 4 | } 5 | 6 | -------------------------------------------------------------------------------- /EventExplorer/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /EventExplorer/src/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-family: 'JetBrains Mono'; 3 | -fx-font-size: 18.0; 4 | } 5 | 6 | -------------------------------------------------------------------------------- /EventExplorer2/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/EventExplorer2/bin/application/Main.class -------------------------------------------------------------------------------- /EventExplorer2/bin/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-background-color: lightgray; 3 | -fx-font-family: 'Arial'; 4 | -fx-font-weight: bold; 5 | -fx-font-style: normal; 6 | -fx-font-size: 14.0px; 7 | -fx-background-radius: 5.0px; 8 | -fx-background-insets: 5.0px; 9 | -fx-padding: 10.0px; 10 | -fx-spacing: 10.0px; 11 | -fx-hgap: 10.0px; 12 | -fx-vgap: 10.0px; 13 | } 14 | 15 | .vbox { 16 | -fx-fill-width: true; 17 | } 18 | .grid-pane { 19 | -fx-padding: 10.0; 20 | -fx-hgap: 10.0; 21 | -fx-vgap: 10.0; 22 | -fx-alignment: center; 23 | } 24 | 25 | .button { 26 | -fx-pref-height: 25.0px; 27 | -fx-pref-width: 100.0px; 28 | } 29 | 30 | .label { 31 | -fx-alignment: bottom-right; 32 | 33 | } 34 | 35 | .text-area { 36 | -fx-background-radius: 5.0px; 37 | -fx-background-insets: 5.0px; 38 | } -------------------------------------------------------------------------------- /EventExplorer2/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /EventExplorer2/src/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-background-color: lightgray; 3 | -fx-font-family: 'Arial'; 4 | -fx-font-weight: bold; 5 | -fx-font-style: normal; 6 | -fx-font-size: 14.0px; 7 | -fx-background-radius: 5.0px; 8 | -fx-background-insets: 5.0px; 9 | -fx-padding: 10.0px; 10 | -fx-spacing: 10.0px; 11 | -fx-hgap: 10.0px; 12 | -fx-vgap: 10.0px; 13 | } 14 | 15 | .vbox { 16 | -fx-fill-width: true; 17 | } 18 | .grid-pane { 19 | -fx-padding: 10.0; 20 | -fx-hgap: 10.0; 21 | -fx-vgap: 10.0; 22 | -fx-alignment: center; 23 | } 24 | 25 | .button { 26 | -fx-pref-height: 25.0px; 27 | -fx-pref-width: 100.0px; 28 | } 29 | 30 | .label { 31 | -fx-alignment: bottom-right; 32 | 33 | } 34 | 35 | .text-area { 36 | -fx-background-radius: 5.0px; 37 | -fx-background-insets: 5.0px; 38 | } -------------------------------------------------------------------------------- /FileChooserDemo/bin/com/javacodejunkie/FXUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/FileChooserDemo/bin/com/javacodejunkie/FXUtils.class -------------------------------------------------------------------------------- /FileChooserDemo/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/FileChooserDemo/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /FileChooserDemo/bin/com/javacodejunkie/MainView$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/FileChooserDemo/bin/com/javacodejunkie/MainView$1.class -------------------------------------------------------------------------------- /FileChooserDemo/bin/com/javacodejunkie/MainView$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/FileChooserDemo/bin/com/javacodejunkie/MainView$2.class -------------------------------------------------------------------------------- /FileChooserDemo/bin/com/javacodejunkie/MainView$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/FileChooserDemo/bin/com/javacodejunkie/MainView$3.class -------------------------------------------------------------------------------- /FileChooserDemo/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/FileChooserDemo/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /FileChooserDemo/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } -------------------------------------------------------------------------------- /FileChooserDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /FileChooserDemo/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage stage) { 10 | MainView mainView = new MainView(stage); 11 | mainView.show(); 12 | } 13 | 14 | public static void main(String[] args) { 15 | launch(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /FileChooserDemo/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } -------------------------------------------------------------------------------- /FlowPane Explorer/FlowPane Explorer.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /FlowPane Explorer/out/production/FlowPane Explorer/sample/Controller.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/FlowPane Explorer/out/production/FlowPane Explorer/sample/Controller.class -------------------------------------------------------------------------------- /FlowPane Explorer/out/production/FlowPane Explorer/sample/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/FlowPane Explorer/out/production/FlowPane Explorer/sample/Main.class -------------------------------------------------------------------------------- /FlowPane Explorer/out/production/FlowPane Explorer/sample/sample.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | -------------------------------------------------------------------------------- /FlowPane Explorer/src/sample/Controller.java: -------------------------------------------------------------------------------- 1 | package sample; 2 | 3 | public class Controller { 4 | } 5 | -------------------------------------------------------------------------------- /FlowPane Explorer/src/sample/Main.java: -------------------------------------------------------------------------------- 1 | package sample; 2 | 3 | import javafx.application.Application; 4 | import javafx.geometry.Pos; 5 | import javafx.scene.Scene; 6 | import javafx.scene.control.Button; 7 | import javafx.scene.layout.FlowPane; 8 | import javafx.stage.Stage; 9 | 10 | public class Main extends Application { 11 | 12 | public static void main(String[] args) { 13 | launch(args); 14 | } 15 | 16 | @Override 17 | public void start(Stage primaryStage) throws Exception { 18 | primaryStage.setTitle("FlowPane Explorer"); 19 | 20 | // Create 4 Buttons to demonstrate FlowPane behaviour 21 | Button button1 = new Button("One"); 22 | Button button2 = new Button("Two"); 23 | Button button3 = new Button("Three"); 24 | Button button4 = new Button("Four"); 25 | 26 | // Create FlowPane as the root of our Scene Graph 27 | FlowPane root = new FlowPane(); 28 | 29 | // Set gap between child nodes 30 | root.setHgap(10); 31 | root.setVgap(10); 32 | 33 | // Add Buttons to the FlowPane 34 | root.getChildren().addAll(button1, button2, button3, button4); 35 | 36 | // Set Alignment of child nodes in the FlowPane 37 | root.setAlignment(Pos.TOP_CENTER); 38 | 39 | // FlowPane can also layout child nodes vertically 40 | // root.setOrientation(Orientation.VERTICAL); 41 | 42 | // FlowPane has an alternate Constructor that allows us to specify the 43 | // Orientation, Hgap, Vgap and Child nodes when we create a new FlowPane Object. 44 | // Ths replaces the need for separate method calls after creating a new FlowPane. 45 | // FlowPane root = new FlowPane(Orientation.VERTICAL, 10, 10, button1, button2, button3, button4); 46 | 47 | primaryStage.setScene(new Scene(root, 300, 275)); 48 | primaryStage.show(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /FlowPane Explorer/src/sample/sample.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | -------------------------------------------------------------------------------- /GridPaneDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/GridPaneDemo/bin/application/Main.class -------------------------------------------------------------------------------- /GridPaneDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /GridPaneDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /GridPaneDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /HBox Explorer/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/HBox Explorer/bin/application/Main.class -------------------------------------------------------------------------------- /HBox Explorer/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /HBox Explorer/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /HBox Explorer/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.geometry.Insets; 5 | import javafx.scene.Scene; 6 | import javafx.scene.control.Button; 7 | import javafx.scene.layout.HBox; 8 | import javafx.scene.layout.Priority; 9 | import javafx.scene.layout.Region; 10 | import javafx.stage.Stage; 11 | 12 | public class Main extends Application { 13 | @Override 14 | public void start(Stage primaryStage) { 15 | 16 | HBox hbox = new HBox(); 17 | Button button1 = new Button("One"); 18 | // button1.setPrefWidth(75); 19 | button1.setMaxWidth(Integer.MAX_VALUE); 20 | HBox.setMargin(button1, new Insets(10)); 21 | HBox.setHgrow(button1, Priority.SOMETIMES); 22 | 23 | Button button2 = new Button("Two"); 24 | // button2.setPrefWidth(75); 25 | button2.setMaxWidth(Integer.MAX_VALUE); 26 | HBox.setMargin(button2, new Insets(10)); 27 | HBox.setHgrow(button2, Priority.SOMETIMES); 28 | 29 | Button button3 = new Button("Three"); 30 | // button3.setPrefWidth(75); 31 | button3.setMaxWidth(Integer.MAX_VALUE); 32 | HBox.setMargin(button3, new Insets(10)); 33 | HBox.setHgrow(button3, Priority.SOMETIMES); 34 | 35 | Region region = new Region(); 36 | HBox.setHgrow(region, Priority.ALWAYS); 37 | 38 | hbox.getChildren().addAll(button1, button2, region, button3); 39 | 40 | Scene scene = new Scene(hbox, 400, 200); 41 | primaryStage.setScene(scene); 42 | primaryStage.show(); 43 | 44 | } 45 | 46 | public static void main(String[] args) { 47 | launch(args); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /HBox Explorer/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /JavaFX CSS Demo/bin/application/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/JavaFX CSS Demo/bin/application/Main$1.class -------------------------------------------------------------------------------- /JavaFX CSS Demo/bin/application/Main$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/JavaFX CSS Demo/bin/application/Main$2.class -------------------------------------------------------------------------------- /JavaFX CSS Demo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/JavaFX CSS Demo/bin/application/Main.class -------------------------------------------------------------------------------- /JavaFX CSS Demo/bin/application/purple2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/JavaFX CSS Demo/bin/application/purple2.png -------------------------------------------------------------------------------- /JavaFX CSS Demo/bin/application/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-family: 'JetBrains Mono'; 3 | -fx-font-size: 20px; 4 | -fx-font-weight: bold; 5 | -fx-background-color: lightblue; 6 | -fx-background-image: url("/application/purple2.png"); 7 | -fx-background-repeat: no-repeat; 8 | -fx-background-size: stretch; 9 | } 10 | 11 | .label { 12 | -fx-text-fill: white; 13 | } 14 | 15 | .button { 16 | -fx-pref-width: 100px; 17 | } 18 | 19 | #title { 20 | -fx-font-size: 32px; 21 | -fx-text-fill: orange; 22 | } 23 | 24 | .fancy-button { 25 | -fx-background-color: red; 26 | -fx-text-fill: white; 27 | } 28 | 29 | .fancy-button:hover { 30 | -fx-background-color: yellow; 31 | -fx-text-fill: red; 32 | } 33 | 34 | .fancy-button:pressed { 35 | -fx-background-color: green; 36 | -fx-text-fill: white; 37 | } 38 | 39 | .text-field { 40 | -fx-border-color: blue; 41 | -fx-border-width: 3px; 42 | -fx-border-radius: 25px; 43 | -fx-background-radius: 25px; 44 | -fx-pref-column-count: 25; 45 | } -------------------------------------------------------------------------------- /JavaFX CSS Demo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JavaFX CSS Demo/src/application/purple2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/JavaFX CSS Demo/src/application/purple2.png -------------------------------------------------------------------------------- /JavaFX CSS Demo/src/application/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-family: 'JetBrains Mono'; 3 | -fx-font-size: 20px; 4 | -fx-font-weight: bold; 5 | -fx-background-color: lightblue; 6 | -fx-background-image: url("/application/purple2.png"); 7 | -fx-background-repeat: no-repeat; 8 | -fx-background-size: stretch; 9 | } 10 | 11 | .label { 12 | -fx-text-fill: white; 13 | } 14 | 15 | .button { 16 | -fx-pref-width: 100px; 17 | } 18 | 19 | #title { 20 | -fx-font-size: 32px; 21 | -fx-text-fill: orange; 22 | } 23 | 24 | .fancy-button { 25 | -fx-background-color: red; 26 | -fx-text-fill: white; 27 | } 28 | 29 | .fancy-button:hover { 30 | -fx-background-color: yellow; 31 | -fx-text-fill: red; 32 | } 33 | 34 | .fancy-button:pressed { 35 | -fx-background-color: green; 36 | -fx-text-fill: white; 37 | } 38 | 39 | .text-field { 40 | -fx-border-color: blue; 41 | -fx-border-width: 3px; 42 | -fx-border-radius: 25px; 43 | -fx-background-radius: 25px; 44 | -fx-pref-column-count: 25; 45 | } -------------------------------------------------------------------------------- /JavaFX Project (Template)/bin/com/javacodejunkie/FXHelper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/JavaFX Project (Template)/bin/com/javacodejunkie/FXHelper.class -------------------------------------------------------------------------------- /JavaFX Project (Template)/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/JavaFX Project (Template)/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /JavaFX Project (Template)/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/JavaFX Project (Template)/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /JavaFX Project (Template)/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /JavaFX Project (Template)/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JavaFX Project (Template)/src/com/javacodejunkie/FXHelper.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import java.util.List; 4 | import java.util.Objects; 5 | 6 | import javafx.collections.FXCollections; 7 | import javafx.collections.ObservableList; 8 | import javafx.scene.control.Button; 9 | import javafx.scene.control.ComboBox; 10 | import javafx.scene.control.Control; 11 | import javafx.scene.control.Tooltip; 12 | import javafx.scene.image.Image; 13 | import javafx.scene.image.ImageView; 14 | 15 | public class FXHelper { 16 | 17 | private FXHelper() { 18 | } 19 | 20 | public static void setTooltip(Control control, String message) { 21 | if (message.isEmpty()) { 22 | throw new IllegalArgumentException("The message cannot be empty."); 23 | } 24 | control.setTooltip(new Tooltip(message)); 25 | } 26 | 27 | public static Button createImageButton(String imagePath, int width, int height) { 28 | if (imagePath.isEmpty()) { 29 | throw new IllegalArgumentException("The image path cannot be empty."); 30 | } 31 | Button button = new Button(); 32 | Image image = new Image(imagePath, (double) width, (double) height, true, true); 33 | button.setGraphic(new ImageView(image)); 34 | return button; 35 | } 36 | 37 | public static ComboBox createComboBox(final String... options) { 38 | ObservableList list = FXCollections.observableArrayList(); 39 | 40 | for (String option : options) { 41 | if (option != null) { 42 | list.add(option); 43 | } 44 | } 45 | return new ComboBox(list); 46 | } 47 | 48 | public static ComboBox createComboBox(final List options) { 49 | options.removeIf(Objects::isNull); 50 | return new ComboBox<>(FXCollections.observableArrayList(options)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /JavaFX Project (Template)/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | MainView mainView = new MainView(primaryStage); 11 | mainView.show(); 12 | } 13 | 14 | public static void main(String[] args) { 15 | launch(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JavaFX Project (Template)/src/com/javacodejunkie/MainView.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.scene.Scene; 4 | import javafx.scene.layout.BorderPane; 5 | import javafx.stage.Stage; 6 | 7 | public class MainView { 8 | 9 | public Stage stage; 10 | private BorderPane root; 11 | private Scene scene; 12 | 13 | public MainView(Stage stage) { 14 | this.stage = stage; 15 | buildUI(); 16 | } 17 | 18 | private void buildUI() { 19 | root = new BorderPane(); 20 | 21 | scene = new Scene(root, 800, 500); 22 | scene.getStylesheets().add("/com/javacodejunkie/stylesheet.css"); 23 | stage.setTitle("Java Code Junkie - ???"); 24 | stage.setScene(scene); 25 | } 26 | 27 | public void show() { 28 | this.stage.show(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /JavaFX Project (Template)/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } -------------------------------------------------------------------------------- /LabelExplorer/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/LabelExplorer/bin/application/Main.class -------------------------------------------------------------------------------- /LabelExplorer/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /LabelExplorer/bin/application/ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/LabelExplorer/bin/application/ok.png -------------------------------------------------------------------------------- /LabelExplorer/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LabelExplorer/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.scene.Scene; 5 | import javafx.scene.control.Label; 6 | import javafx.scene.image.Image; 7 | import javafx.scene.image.ImageView; 8 | import javafx.scene.layout.BorderPane; 9 | import javafx.scene.text.Font; 10 | import javafx.stage.Stage; 11 | 12 | public class Main extends Application { 13 | @Override 14 | public void start(Stage primaryStage) { 15 | try { 16 | primaryStage.setTitle("Label Explorer"); 17 | BorderPane root = new BorderPane(); 18 | 19 | Image image = new Image(getClass().getResourceAsStream("ok.png")); 20 | ImageView iview = new ImageView(image); 21 | 22 | //Creates an empty label 23 | //Label label = new Label(); 24 | 25 | //Creates Label with supplied text. 26 | //Label label = new Label(text); 27 | 28 | //Creates a Label with the supplied text and graphic. 29 | Label label = new Label("Everything is ok!", iview); 30 | 31 | label.setFont(new Font("Roboto", 18)); 32 | 33 | //label.setRotate(270); 34 | //label.setText("I think everything is ok!?"); 35 | 36 | root.setCenter(label); 37 | 38 | Scene scene = new Scene(root,400,400); 39 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 40 | primaryStage.setScene(scene); 41 | primaryStage.show(); 42 | } catch(Exception e) { 43 | e.printStackTrace(); 44 | } 45 | } 46 | 47 | public static void main(String[] args) { 48 | launch(args); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /LabelExplorer/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /LabelExplorer/src/application/ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/LabelExplorer/src/application/ok.png -------------------------------------------------------------------------------- /LifeCycle/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/LifeCycle/bin/application/Main.class -------------------------------------------------------------------------------- /LifeCycle/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.application.Platform; 5 | import javafx.stage.Stage; 6 | 7 | public class Main extends Application { 8 | 9 | public static void main(String[] args) { 10 | launch(args); 11 | } 12 | 13 | @Override 14 | public void init() throws Exception { 15 | System.out.println("init() executing"); 16 | } 17 | 18 | @Override 19 | public void start(Stage primaryStage) throws Exception { 20 | System.out.println("start() executing"); 21 | Platform.exit(); 22 | } 23 | 24 | @Override 25 | public void stop() throws Exception { 26 | System.out.println("stop() executing"); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /ListViewDemo/bin/application/FXUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ListViewDemo/bin/application/FXUtils.class -------------------------------------------------------------------------------- /ListViewDemo/bin/application/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ListViewDemo/bin/application/Main$1.class -------------------------------------------------------------------------------- /ListViewDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ListViewDemo/bin/application/Main.class -------------------------------------------------------------------------------- /ListViewDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | .root { 3 | -fx-font-family: 'Arial'; 4 | -fx-font-size: 16px; 5 | -fx-background-color: lightgray; 6 | } 7 | 8 | .hbox-pane { 9 | -fx-background-color: inherit; 10 | } 11 | 12 | .header-label { 13 | -fx-font-size: 24px; 14 | -fx-font-weight: BOLD; 15 | -fx-background-color: inherit; 16 | } 17 | */ 18 | -------------------------------------------------------------------------------- /ListViewDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ListViewDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | .root { 3 | -fx-font-family: 'Arial'; 4 | -fx-font-size: 16px; 5 | -fx-background-color: lightgray; 6 | } 7 | 8 | .hbox-pane { 9 | -fx-background-color: inherit; 10 | } 11 | 12 | .header-label { 13 | -fx-font-size: 24px; 14 | -fx-font-weight: BOLD; 15 | -fx-background-color: inherit; 16 | } 17 | */ 18 | -------------------------------------------------------------------------------- /MenuDemo/bin/com/javacodejunkie/FXUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/MenuDemo/bin/com/javacodejunkie/FXUtils.class -------------------------------------------------------------------------------- /MenuDemo/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/MenuDemo/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /MenuDemo/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/MenuDemo/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /MenuDemo/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } -------------------------------------------------------------------------------- /MenuDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MenuDemo/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage stage) { 10 | MainView mainView = new MainView(stage); 11 | mainView.show(); 12 | } 13 | 14 | public static void main(String[] args) { 15 | launch(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /MenuDemo/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } -------------------------------------------------------------------------------- /PaneLayout/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/PaneLayout/bin/application/Main.class -------------------------------------------------------------------------------- /PaneLayout/bin/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } 4 | -------------------------------------------------------------------------------- /PaneLayout/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /PaneLayout/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.scene.Scene; 5 | import javafx.scene.control.Button; 6 | import javafx.scene.control.Label; 7 | import javafx.scene.control.TextField; 8 | import javafx.scene.layout.Pane; 9 | import javafx.stage.Stage; 10 | 11 | public class Main extends Application { 12 | @Override 13 | public void start(Stage primaryStage) { 14 | try { 15 | primaryStage.setTitle("Pane Layout"); 16 | Pane root = new Pane(); 17 | 18 | Label label = new Label("Label"); 19 | label.relocate(30, 30); 20 | 21 | TextField textField = new TextField(); 22 | textField.relocate(100, 30); 23 | 24 | Button button = new Button("Button"); 25 | button.relocate(275, 30); 26 | 27 | root.getChildren().addAll(label, textField, button); 28 | 29 | Scene scene = new Scene(root, 800, 500); 30 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 31 | primaryStage.setScene(scene); 32 | primaryStage.show(); 33 | } catch (Exception e) { 34 | e.printStackTrace(); 35 | } 36 | } 37 | 38 | public static void main(String[] args) { 39 | launch(args); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /PaneLayout/src/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } 4 | -------------------------------------------------------------------------------- /ProgressBarDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ProgressBarDemo/bin/application/Main.class -------------------------------------------------------------------------------- /ProgressBarDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /ProgressBarDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ProgressBarDemo/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.scene.Scene; 5 | import javafx.scene.control.ProgressBar; 6 | import javafx.scene.layout.BorderPane; 7 | import javafx.stage.Stage; 8 | 9 | public class Main extends Application { 10 | @Override 11 | public void start(Stage primaryStage) { 12 | try { 13 | BorderPane root = new BorderPane(); 14 | 15 | ProgressBar progressBar = new ProgressBar(0); 16 | 17 | progressBar.setProgress(0.75); 18 | 19 | Double currentProgress = progressBar.getProgress(); 20 | 21 | System.out.println(currentProgress); 22 | 23 | progressBar.setPrefSize(300, 25); 24 | 25 | root.setCenter(progressBar); 26 | 27 | Scene scene = new Scene(root, 400, 400); 28 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 29 | primaryStage.setScene(scene); 30 | primaryStage.setTitle("ProgressBar Demo"); 31 | primaryStage.show(); 32 | } catch (Exception e) { 33 | e.printStackTrace(); 34 | } 35 | } 36 | 37 | public static void main(String[] args) { 38 | launch(args); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ProgressBarDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /PropertiesDemo/bin/com/javacodejunkie/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/PropertiesDemo/bin/com/javacodejunkie/Main$1.class -------------------------------------------------------------------------------- /PropertiesDemo/bin/com/javacodejunkie/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/PropertiesDemo/bin/com/javacodejunkie/Main.class -------------------------------------------------------------------------------- /PropertiesDemo/bin/com/javacodejunkie/Person.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/PropertiesDemo/bin/com/javacodejunkie/Person.class -------------------------------------------------------------------------------- /PropertiesDemo/src/com/javacodejunkie/Main.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.beans.property.StringProperty; 4 | import javafx.beans.value.ChangeListener; 5 | import javafx.beans.value.ObservableValue; 6 | 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | Person person = new Person(); 11 | person.setFirstName("Bob"); 12 | System.out.println(person.getFirstName()); 13 | String firstName = person.getFirstName(); 14 | System.out.println(firstName); 15 | StringProperty firstNameProperty = person.firstNameProperty(); 16 | firstNameProperty.addListener(new ChangeListener() { 17 | @Override 18 | public void changed(ObservableValue observable, String oldValue, String newValue) { 19 | System.out.println("First Name changed from " + oldValue + " to " +newValue); 20 | } 21 | }); 22 | person.setFirstName("Buddy"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /PropertiesDemo/src/com/javacodejunkie/Person.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.beans.property.SimpleStringProperty; 4 | import javafx.beans.property.StringProperty; 5 | 6 | public class Person { 7 | 8 | private StringProperty firstName; 9 | 10 | public Person() { 11 | firstName = new SimpleStringProperty(this, "firstName", ""); 12 | } 13 | 14 | public String getFirstName() { 15 | return this.firstName.get(); 16 | } 17 | 18 | public void setFirstName(String firstName) { 19 | this.firstName.set(firstName); 20 | } 21 | 22 | public StringProperty firstNameProperty() { 23 | return this.firstName; 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /RadioButtonDemo/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/RadioButtonDemo/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /RadioButtonDemo/bin/com/javacodejunkie/MainView$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/RadioButtonDemo/bin/com/javacodejunkie/MainView$1.class -------------------------------------------------------------------------------- /RadioButtonDemo/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/RadioButtonDemo/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /RadioButtonDemo/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } -------------------------------------------------------------------------------- /RadioButtonDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RadioButtonDemo/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | MainView mainView = new MainView(primaryStage); 11 | mainView.show(); 12 | } 13 | 14 | public static void main(String[] args) { 15 | launch(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /RadioButtonDemo/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } -------------------------------------------------------------------------------- /SceneBuilderIntro/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SceneBuilderIntro/bin/application/Main.class -------------------------------------------------------------------------------- /SceneBuilderIntro/bin/application/Sample.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 |
30 | -------------------------------------------------------------------------------- /SceneBuilderIntro/bin/application/SampleController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SceneBuilderIntro/bin/application/SampleController.class -------------------------------------------------------------------------------- /SceneBuilderIntro/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /SceneBuilderIntro/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SceneBuilderIntro/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | import javafx.scene.Scene; 6 | import javafx.scene.layout.BorderPane; 7 | import javafx.fxml.FXMLLoader; 8 | 9 | 10 | public class Main extends Application { 11 | @Override 12 | public void start(Stage primaryStage) { 13 | try { 14 | BorderPane root = (BorderPane)FXMLLoader.load(getClass().getResource("Sample.fxml")); 15 | Scene scene = new Scene(root,400,400); 16 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 17 | primaryStage.setScene(scene); 18 | primaryStage.show(); 19 | } catch(Exception e) { 20 | e.printStackTrace(); 21 | } 22 | } 23 | 24 | public static void main(String[] args) { 25 | launch(args); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SceneBuilderIntro/src/application/Sample.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 |
30 | -------------------------------------------------------------------------------- /SceneBuilderIntro/src/application/SampleController.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.event.ActionEvent; 4 | import javafx.fxml.FXML; 5 | import javafx.scene.control.Button; 6 | import javafx.scene.control.Label; 7 | 8 | public class SampleController { 9 | 10 | @FXML 11 | private Button button; 12 | 13 | @FXML 14 | private Label label; 15 | 16 | @FXML 17 | public void onButtonClicked(ActionEvent event) { 18 | label.setText("Button Clicked!"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /SceneBuilderIntro/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /SceneExplorer/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SceneExplorer/bin/application/Main.class -------------------------------------------------------------------------------- /SceneExplorer/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /SceneExplorer/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SceneExplorer/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.scene.Cursor; 5 | import javafx.scene.Parent; 6 | import javafx.scene.Scene; 7 | import javafx.scene.layout.VBox; 8 | import javafx.scene.paint.Color; 9 | import javafx.stage.Stage; 10 | 11 | 12 | public class Main extends Application { 13 | private Stage stage; 14 | 15 | @Override 16 | public void start(Stage primaryStage) { 17 | this.stage = primaryStage; 18 | this.stage.setTitle("Primary Stage"); 19 | 20 | Parent root = new VBox(); 21 | 22 | //Scene scene = new Scene(root); 23 | //Scene scene = new Scene(root, Color.RED); 24 | //Scene scene = new Scene(root, 400, 300); 25 | Scene scene = new Scene(root, 400, 300, Color.RED); 26 | scene.setCursor(Cursor.CROSSHAIR); 27 | 28 | this.stage.setScene(scene); 29 | this.stage.show(); 30 | } 31 | 32 | public static void main(String[] args) { 33 | launch(args); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SceneExplorer/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /SliderDemo/bin/application/FXUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SliderDemo/bin/application/FXUtils.class -------------------------------------------------------------------------------- /SliderDemo/bin/application/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SliderDemo/bin/application/Main$1.class -------------------------------------------------------------------------------- /SliderDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SliderDemo/bin/application/Main.class -------------------------------------------------------------------------------- /SliderDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } 4 | 5 | .slider { 6 | -fx-background-color: BLACK; 7 | } 8 | 9 | .slider .thumb { 10 | -fx-background-color: ORANGE; 11 | } 12 | 13 | .slider .track { 14 | -fx-background-color: LIGHTGREY; 15 | } 16 | .slider:vertical .track { 17 | -fx-background-color: GREY; 18 | } 19 | .slider .axis { 20 | -fx-tick-label-fill: LIGHTGREY; 21 | } -------------------------------------------------------------------------------- /SliderDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SliderDemo/src/application/FXUtils.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import java.io.FileInputStream; 4 | import java.io.FileNotFoundException; 5 | 6 | import javafx.geometry.Insets; 7 | import javafx.geometry.Pos; 8 | import javafx.scene.Node; 9 | import javafx.scene.control.Button; 10 | import javafx.scene.image.Image; 11 | import javafx.scene.image.ImageView; 12 | import javafx.scene.layout.HBox; 13 | import javafx.scene.layout.VBox; 14 | 15 | public class FXUtils { 16 | 17 | public static HBox createHBox(Node... children) { 18 | HBox hbox = new HBox(children); 19 | hbox.setAlignment(Pos.BASELINE_CENTER); 20 | hbox.setPadding(new Insets(10)); 21 | hbox.setSpacing(10); 22 | 23 | return hbox; 24 | } 25 | 26 | public static VBox createVBox(Node... children) { 27 | VBox vbox = new VBox(children); 28 | vbox.setAlignment(Pos.BASELINE_CENTER); 29 | vbox.setPadding(new Insets(10)); 30 | vbox.setSpacing(10); 31 | 32 | return vbox; 33 | } 34 | 35 | public static Button createButton(String text) { 36 | Button button = new Button(text); 37 | return button; 38 | } 39 | 40 | public static Button createButtonWithIcon(String text, String url) throws FileNotFoundException { 41 | Button button = new Button(); 42 | FileInputStream input = new FileInputStream(url); 43 | Image image = new Image(input); 44 | ImageView imageView = new ImageView(image); 45 | button.setText(text); 46 | button.setGraphic(imageView); 47 | return button; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SliderDemo/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.beans.value.ChangeListener; 5 | import javafx.beans.value.ObservableValue; 6 | import javafx.scene.Scene; 7 | import javafx.scene.control.Label; 8 | import javafx.scene.control.Slider; 9 | import javafx.scene.layout.BorderPane; 10 | import javafx.scene.layout.HBox; 11 | import javafx.stage.Stage; 12 | 13 | 14 | public class Main extends Application { 15 | @Override 16 | public void start(Stage primaryStage) { 17 | try { 18 | primaryStage.setTitle("Slider Demo"); 19 | BorderPane root = new BorderPane(); 20 | 21 | Slider slider = new Slider(0, 100, 50); 22 | slider.setPrefWidth(500); 23 | slider.setShowTickMarks(true); 24 | slider.setShowTickLabels(true); 25 | slider.setMajorTickUnit(10); 26 | slider.setMinorTickCount(3); 27 | slider.setBlockIncrement(5); 28 | slider.setSnapToTicks(true); 29 | 30 | Label label = new Label("???"); 31 | 32 | HBox hbox1 = FXUtils.createHBox(slider, label); 33 | 34 | slider.valueProperty().addListener(new ChangeListener() { 35 | @Override 36 | public void changed(ObservableValue observable, Number oldValue, Number newValue) { 37 | label.setText(Integer.toString((int)slider.getValue())); 38 | } 39 | }); 40 | 41 | 42 | root.setCenter(hbox1); 43 | 44 | 45 | Scene scene = new Scene(root,700,400); 46 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 47 | primaryStage.setScene(scene); 48 | primaryStage.show(); 49 | } catch(Exception e) { 50 | e.printStackTrace(); 51 | } 52 | } 53 | 54 | public static void main(String[] args) { 55 | launch(args); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /SliderDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } 4 | 5 | .slider { 6 | -fx-background-color: BLACK; 7 | } 8 | 9 | .slider .thumb { 10 | -fx-background-color: ORANGE; 11 | } 12 | 13 | .slider .track { 14 | -fx-background-color: LIGHTGREY; 15 | } 16 | .slider:vertical .track { 17 | -fx-background-color: GREY; 18 | } 19 | .slider .axis { 20 | -fx-tick-label-fill: LIGHTGREY; 21 | } -------------------------------------------------------------------------------- /SpinnerDemo/bin/application/FXUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SpinnerDemo/bin/application/FXUtils.class -------------------------------------------------------------------------------- /SpinnerDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SpinnerDemo/bin/application/Main.class -------------------------------------------------------------------------------- /SpinnerDemo/bin/application/WeekDay.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SpinnerDemo/bin/application/WeekDay.class -------------------------------------------------------------------------------- /SpinnerDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /SpinnerDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SpinnerDemo/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.beans.value.ChangeListener; 5 | import javafx.beans.value.ObservableValue; 6 | import javafx.collections.FXCollections; 7 | import javafx.collections.ObservableList; 8 | import javafx.geometry.Insets; 9 | import javafx.scene.Scene; 10 | import javafx.scene.control.Label; 11 | import javafx.scene.control.Spinner; 12 | import javafx.scene.layout.GridPane; 13 | import javafx.stage.Stage; 14 | 15 | public class Main extends Application { 16 | @Override 17 | public void start(Stage primaryStage) { 18 | 19 | primaryStage.setTitle("Spinner Demo"); 20 | 21 | GridPane root = new GridPane(); 22 | root.setPadding(new Insets(10)); 23 | root.setHgap(10); 24 | root.setVgap(10); 25 | 26 | Spinner spinner = new Spinner<>(1, 10, 5); 27 | 28 | root.add(spinner, 0, 0); 29 | 30 | spinner.getValueFactory().wrapAroundProperty().set(true); 31 | 32 | spinner.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); 33 | 34 | Scene scene = new Scene(root, 400, 400); 35 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 36 | primaryStage.setScene(scene); 37 | primaryStage.show(); 38 | } 39 | 40 | public static void main(String[] args) { 41 | launch(args); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /SpinnerDemo/src/application/WeekDay.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | public enum WeekDay { 4 | SUNDAY, 5 | MONDAY, 6 | TUESDAY, 7 | WEDNESDAY, 8 | THURSDAY, 9 | FRIDAY, 10 | SATURDAY 11 | } 12 | -------------------------------------------------------------------------------- /SpinnerDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /StackPane Demo/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/StackPane Demo/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /StackPane Demo/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/StackPane Demo/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /StackPane Demo/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 36; 3 | } 4 | 5 | .label { 6 | -fx-background-color: pink; 7 | -fx-text-fill: black; 8 | } 9 | 10 | .button { 11 | -fx-font-size: 24; 12 | } -------------------------------------------------------------------------------- /StackPane Demo/bin/com/javacodejunkie/yoda.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/StackPane Demo/bin/com/javacodejunkie/yoda.jpg -------------------------------------------------------------------------------- /StackPane Demo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /StackPane Demo/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | MainView mainView = new MainView(primaryStage); 11 | mainView.show(); 12 | } 13 | 14 | public static void main(String[] args) { 15 | launch(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /StackPane Demo/src/com/javacodejunkie/MainView.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.geometry.Pos; 4 | import javafx.scene.Scene; 5 | import javafx.scene.control.Button; 6 | import javafx.scene.control.Label; 7 | import javafx.scene.image.ImageView; 8 | import javafx.scene.layout.StackPane; 9 | import javafx.stage.Stage; 10 | 11 | public class MainView { 12 | 13 | public Stage stage; 14 | private Scene scene; 15 | 16 | public MainView(Stage stage) { 17 | this.stage = stage; 18 | buildUI(); 19 | } 20 | 21 | private void buildUI() { 22 | StackPane stackPane = new StackPane(); 23 | 24 | // Layer 1 - Image 25 | ImageView iview = new ImageView("/com/javacodejunkie/yoda.jpg"); 26 | stackPane.getChildren().add(iview); 27 | 28 | // Layer 2 - Label 29 | Label label = new Label(" Do, or do not! There is no try! "); 30 | stackPane.getChildren().add(label); 31 | StackPane.setAlignment(label, Pos.BOTTOM_CENTER); 32 | 33 | // Layer 3 - Button 34 | Button button = new Button("Click"); 35 | button.setOnAction(e -> label.setText(" Always pass on what you have learned ")); 36 | stackPane.getChildren().add(button); 37 | StackPane.setAlignment(button, Pos.TOP_RIGHT); 38 | 39 | 40 | scene = new Scene(stackPane); 41 | scene.getStylesheets().add("/com/javacodejunkie/stylesheet.css"); 42 | stage.setTitle("Java Code Junkie - StackPane Demo"); 43 | stage.setScene(scene); 44 | } 45 | 46 | public void show() { 47 | this.stage.show(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /StackPane Demo/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 36; 3 | } 4 | 5 | .label { 6 | -fx-background-color: pink; 7 | -fx-text-fill: black; 8 | } 9 | 10 | .button { 11 | -fx-font-size: 24; 12 | } -------------------------------------------------------------------------------- /StackPane Demo/src/com/javacodejunkie/yoda.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/StackPane Demo/src/com/javacodejunkie/yoda.jpg -------------------------------------------------------------------------------- /StageExplorer/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/StageExplorer/bin/application/Main.class -------------------------------------------------------------------------------- /StageExplorer/bin/application/MyStage$MyEventHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/StageExplorer/bin/application/MyStage$MyEventHandler.class -------------------------------------------------------------------------------- /StageExplorer/bin/application/MyStage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/StageExplorer/bin/application/MyStage.class -------------------------------------------------------------------------------- /StageExplorer/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /StageExplorer/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /StageExplorer/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.event.EventHandler; 5 | import javafx.scene.Scene; 6 | import javafx.scene.layout.BorderPane; 7 | import javafx.scene.paint.Color; 8 | import javafx.stage.Modality; 9 | import javafx.stage.Stage; 10 | import javafx.stage.StageStyle; 11 | import javafx.stage.WindowEvent; 12 | 13 | class MyStage extends Stage { 14 | private BorderPane root = new BorderPane(); 15 | private Scene scene = new Scene(root, 400, 300); 16 | 17 | MyStage() { 18 | initStage(); 19 | } 20 | 21 | MyStage(StageStyle style) { 22 | this.initStyle(style); 23 | initStage(); 24 | } 25 | 26 | private void initStage() { 27 | this.scene.setFill(Color.DODGERBLUE); 28 | this.setScene(scene); 29 | this.setTitle("Stage Title"); 30 | this.initModality(Modality.NONE); 31 | this.setOnCloseRequest(new MyEventHandler()); 32 | this.onCloseRequestProperty().set(new MyEventHandler()); 33 | } 34 | 35 | private class MyEventHandler implements EventHandler { 36 | @Override 37 | public void handle(WindowEvent event) { 38 | System.out.println("Window Close Request Received"); 39 | } 40 | } 41 | } 42 | 43 | public class Main extends Application { 44 | @Override 45 | public void start(Stage primaryStage) { 46 | try { 47 | Stage stage1 = new MyStage(); 48 | stage1.show(); 49 | Stage stage2 = new MyStage(StageStyle.UTILITY); 50 | stage2.show(); 51 | } catch (Exception e) { 52 | e.printStackTrace(); 53 | } 54 | } 55 | 56 | public static void main(String[] args) { 57 | launch(args); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /StageExplorer/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /SwitchingScenesDemo/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SwitchingScenesDemo/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /SwitchingScenesDemo/bin/com/javacodejunkie/MainView$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SwitchingScenesDemo/bin/com/javacodejunkie/MainView$1.class -------------------------------------------------------------------------------- /SwitchingScenesDemo/bin/com/javacodejunkie/MainView$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SwitchingScenesDemo/bin/com/javacodejunkie/MainView$2.class -------------------------------------------------------------------------------- /SwitchingScenesDemo/bin/com/javacodejunkie/MainView$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SwitchingScenesDemo/bin/com/javacodejunkie/MainView$3.class -------------------------------------------------------------------------------- /SwitchingScenesDemo/bin/com/javacodejunkie/MainView$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SwitchingScenesDemo/bin/com/javacodejunkie/MainView$4.class -------------------------------------------------------------------------------- /SwitchingScenesDemo/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SwitchingScenesDemo/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /SwitchingScenesDemo/bin/com/javacodejunkie/SwitchScenesA.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SwitchingScenesDemo/bin/com/javacodejunkie/SwitchScenesA.class -------------------------------------------------------------------------------- /SwitchingScenesDemo/bin/com/javacodejunkie/SwitchScenesB.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SwitchingScenesDemo/bin/com/javacodejunkie/SwitchScenesB.class -------------------------------------------------------------------------------- /SwitchingScenesDemo/bin/com/javacodejunkie/SwitchScenesC.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/SwitchingScenesDemo/bin/com/javacodejunkie/SwitchScenesC.class -------------------------------------------------------------------------------- /SwitchingScenesDemo/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 18px; 3 | } 4 | -------------------------------------------------------------------------------- /SwitchingScenesDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwitchingScenesDemo/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) throws InterruptedException { 10 | MainView mainView = new MainView(primaryStage); 11 | mainView.show(); 12 | } 13 | 14 | public static void main(String[] args) { 15 | launch(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SwitchingScenesDemo/src/com/javacodejunkie/SwitchScenesB.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.scene.Scene; 5 | import javafx.scene.control.Button; 6 | import javafx.scene.layout.VBox; 7 | import javafx.stage.Stage; 8 | 9 | public class SwitchScenesB extends Application { 10 | 11 | private Stage stage; 12 | 13 | private Scene scene1; 14 | private VBox vbox1; 15 | private Button button1; 16 | 17 | private Scene scene2; 18 | private VBox vbox2; 19 | private Button button2; 20 | 21 | @Override 22 | public void start(Stage primaryStage) throws Exception { 23 | 24 | stage = primaryStage; 25 | stage.setTitle("Switching Scenes"); 26 | 27 | scene1 = createSceneOne(); 28 | scene2 = createSceneTwo(); 29 | 30 | stage.setScene(scene1); 31 | 32 | stage.show(); 33 | } 34 | 35 | private Scene createSceneOne() { 36 | 37 | button1 = new Button("Click to show Scene 2"); 38 | button1.setOnAction(e -> switchScenes(scene2)); // Switch Scenes 39 | vbox1 = new VBox(button1); 40 | vbox1.setStyle("-fx-background-color: green"); 41 | scene1 = new Scene(vbox1, 800, 500); 42 | scene1.getStylesheets().add("/com/javacodejunkie/stylesheet.css"); 43 | 44 | return scene1; 45 | } 46 | 47 | private Scene createSceneTwo() { 48 | 49 | button2 = new Button("Click to show Scene 1"); 50 | button2.setOnAction(e -> switchScenes(scene1)); // Switch Scenes 51 | vbox2 = new VBox(button2); 52 | vbox2.setStyle("-fx-background-color: yellow"); 53 | scene2 = new Scene(vbox2, 700, 400); 54 | scene2.getStylesheets().add("/com/javacodejunkie/stylesheet.css"); 55 | 56 | return scene2; 57 | } 58 | 59 | // Switch Scenes in single Stage 60 | public void switchScenes(Scene scene) { 61 | stage.setScene(scene); 62 | } 63 | 64 | public static void main(String[] args) { 65 | Application.launch(args); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /SwitchingScenesDemo/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 18px; 3 | } 4 | -------------------------------------------------------------------------------- /TabEvents/bin/application/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TabEvents/bin/application/Main$1.class -------------------------------------------------------------------------------- /TabEvents/bin/application/Main$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TabEvents/bin/application/Main$2.class -------------------------------------------------------------------------------- /TabEvents/bin/application/Main$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TabEvents/bin/application/Main$3.class -------------------------------------------------------------------------------- /TabEvents/bin/application/Main$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TabEvents/bin/application/Main$4.class -------------------------------------------------------------------------------- /TabEvents/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TabEvents/bin/application/Main.class -------------------------------------------------------------------------------- /TabEvents/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /TabEvents/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TabEvents/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /TabPaneDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TabPaneDemo/bin/application/Main.class -------------------------------------------------------------------------------- /TabPaneDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | 3 | } 4 | 5 | .vbox-pane { 6 | -fx-background-color: khaki; 7 | } 8 | -------------------------------------------------------------------------------- /TabPaneDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TabPaneDemo/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.geometry.Side; 5 | import javafx.scene.Scene; 6 | import javafx.scene.control.Button; 7 | import javafx.scene.control.Tab; 8 | import javafx.scene.control.TabPane; 9 | import javafx.scene.layout.BorderPane; 10 | import javafx.scene.layout.VBox; 11 | import javafx.stage.Stage; 12 | 13 | public class Main extends Application { 14 | 15 | private Stage stage; 16 | private TabPane tabPane; 17 | 18 | @Override 19 | public void start(Stage primaryStage) { 20 | try { 21 | this.stage = primaryStage; 22 | stage.setTitle("TabPane Demo"); 23 | BorderPane root = new BorderPane(); 24 | 25 | tabPane = new TabPane(); 26 | tabPane.setSide(Side.BOTTOM); 27 | 28 | // Tab tab1 = new Tab("Tab 1"); 29 | // tab1.setClosable(false); 30 | // Button button1 = new Button("Button 1"); 31 | // VBox vbox1 = new VBox(10); 32 | // vbox1.getChildren().addAll(button1); 33 | // tab1.setContent(vbox1); 34 | // 35 | // tabPane.getTabs().add(tab1); 36 | // 37 | // Tab tab2 = new Tab("Tab 2"); 38 | // tab2.setClosable(false); 39 | // Button button2 = new Button("Button 2"); 40 | // tab2.setContent(button2); 41 | // 42 | // tabPane.getTabs().add(tab2); 43 | // 44 | // tabPane.getSelectionModel().select(1); 45 | 46 | for (int i = 1; i<= 20; i++) { 47 | Tab tab = new Tab("Tab" + Integer.toString(i)); 48 | Button button = new Button("Button" + Integer.toString(i)); 49 | tab.setContent(button); 50 | tabPane.getTabs().add(tab); 51 | } 52 | 53 | 54 | root.setCenter(tabPane); 55 | 56 | Scene scene = new Scene(root, 800, 500); 57 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 58 | primaryStage.setScene(scene); 59 | primaryStage.show(); 60 | } catch (Exception e) { 61 | e.printStackTrace(); 62 | } 63 | } 64 | 65 | public static void main(String[] args) { 66 | launch(args); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /TabPaneDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | 3 | } 4 | 5 | .vbox-pane { 6 | -fx-background-color: khaki; 7 | } 8 | -------------------------------------------------------------------------------- /TableViewDemo-2/bin/application/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo-2/bin/application/Main$1.class -------------------------------------------------------------------------------- /TableViewDemo-2/bin/application/Main$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo-2/bin/application/Main$2.class -------------------------------------------------------------------------------- /TableViewDemo-2/bin/application/Main$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo-2/bin/application/Main$3.class -------------------------------------------------------------------------------- /TableViewDemo-2/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo-2/bin/application/Main.class -------------------------------------------------------------------------------- /TableViewDemo-2/bin/application/Person.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo-2/bin/application/Person.class -------------------------------------------------------------------------------- /TableViewDemo-2/bin/application/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-family: 'Arial'; 3 | -fx-font-size: 18px; 4 | -fx-font-style: normal; 5 | -fx-font-weight: normal; 6 | } -------------------------------------------------------------------------------- /TableViewDemo-2/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TableViewDemo-2/src/application/Person.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | public class Person { 4 | private String firstName; 5 | private String lastName; 6 | private int age; 7 | 8 | public Person() { 9 | this.firstName = ""; 10 | this.lastName = ""; 11 | this.age = 0; 12 | } 13 | 14 | public Person(String firstName, String lastName, int age) { 15 | this.firstName = firstName; 16 | this.lastName = lastName; 17 | this.age = age; 18 | } 19 | 20 | public String getFirstName() { 21 | return firstName; 22 | } 23 | 24 | public void setFirstName(String firstName) { 25 | this.firstName = firstName; 26 | } 27 | 28 | public String getLastName() { 29 | return lastName; 30 | } 31 | 32 | public void setLastName(String lastName) { 33 | this.lastName = lastName; 34 | } 35 | 36 | public int getAge() { 37 | return age; 38 | } 39 | 40 | public void setAge(int age) { 41 | this.age = age; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /TableViewDemo-2/src/application/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-family: 'Arial'; 3 | -fx-font-size: 18px; 4 | -fx-font-style: normal; 5 | -fx-font-weight: normal; 6 | } -------------------------------------------------------------------------------- /TableViewDemo-3/bin/application/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo-3/bin/application/MainView.class -------------------------------------------------------------------------------- /TableViewDemo-3/bin/application/Person.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo-3/bin/application/Person.class -------------------------------------------------------------------------------- /TableViewDemo-3/bin/application/PersonTableView$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo-3/bin/application/PersonTableView$1.class -------------------------------------------------------------------------------- /TableViewDemo-3/bin/application/PersonTableView$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo-3/bin/application/PersonTableView$2.class -------------------------------------------------------------------------------- /TableViewDemo-3/bin/application/PersonTableView$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo-3/bin/application/PersonTableView$3.class -------------------------------------------------------------------------------- /TableViewDemo-3/bin/application/PersonTableView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo-3/bin/application/PersonTableView.class -------------------------------------------------------------------------------- /TableViewDemo-3/bin/application/TableViewDemo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo-3/bin/application/TableViewDemo.class -------------------------------------------------------------------------------- /TableViewDemo-3/bin/application/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-family: 'Arial'; 3 | -fx-font-size: 18px; 4 | -fx-font-style: normal; 5 | -fx-font-weight: normal; 6 | } -------------------------------------------------------------------------------- /TableViewDemo-3/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TableViewDemo-3/src/application/MainView.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.scene.Scene; 4 | import javafx.scene.layout.BorderPane; 5 | import javafx.stage.Stage; 6 | import javafx.stage.StageStyle; 7 | 8 | public class MainView { 9 | 10 | private Stage stage; 11 | private PersonTableView table; 12 | 13 | public MainView() { 14 | buildUI(); 15 | } 16 | 17 | private void buildUI() { 18 | stage = new Stage(StageStyle.DECORATED); 19 | 20 | BorderPane root = new BorderPane(); 21 | 22 | table = new PersonTableView(); 23 | 24 | table.add(new Person("Buggs", "Bunny", 79)); 25 | table.add(new Person("Daffy", "Duck", 83)); 26 | table.add(new Person("Foghorn", "Leghorn", 74)); 27 | table.add(new Person("Elmer", "Fudd", 83)); 28 | table.add(new Person("Tweety", "Bird", 73)); 29 | 30 | root.setCenter(table); 31 | 32 | Scene scene = new Scene(root, 500, 300); 33 | scene.getStylesheets().add("application/stylesheet.css"); 34 | stage.setTitle("TableView Demo"); 35 | stage.setScene(scene); 36 | stage.show(); 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /TableViewDemo-3/src/application/Person.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | public class Person { 4 | private String firstName; 5 | private String lastName; 6 | private int age; 7 | 8 | public Person() { 9 | this.firstName = ""; 10 | this.lastName = ""; 11 | this.age = 0; 12 | } 13 | 14 | public Person(String firstName, String lastName, int age) { 15 | this.firstName = firstName; 16 | this.lastName = lastName; 17 | this.age = age; 18 | } 19 | 20 | public String getFirstName() { 21 | return firstName; 22 | } 23 | 24 | public void setFirstName(String firstName) { 25 | this.firstName = firstName; 26 | } 27 | 28 | public String getLastName() { 29 | return lastName; 30 | } 31 | 32 | public void setLastName(String lastName) { 33 | this.lastName = lastName; 34 | } 35 | 36 | public int getAge() { 37 | return age; 38 | } 39 | 40 | public void setAge(int age) { 41 | this.age = age; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /TableViewDemo-3/src/application/TableViewDemo.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class TableViewDemo extends Application { 7 | 8 | public static void main(String[] args) { 9 | launch(args); 10 | } 11 | 12 | @Override 13 | public void start(Stage primaryStage) { 14 | new MainView(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /TableViewDemo-3/src/application/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-family: 'Arial'; 3 | -fx-font-size: 18px; 4 | -fx-font-style: normal; 5 | -fx-font-weight: normal; 6 | } -------------------------------------------------------------------------------- /TableViewDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo/bin/application/Main.class -------------------------------------------------------------------------------- /TableViewDemo/bin/application/Person.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TableViewDemo/bin/application/Person.class -------------------------------------------------------------------------------- /TableViewDemo/bin/application/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-family: 'Arial'; 3 | -fx-font-size: 18px; 4 | -fx-font-style: normal; 5 | -fx-font-weight: normal; 6 | } -------------------------------------------------------------------------------- /TableViewDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TableViewDemo/src/application/Person.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | public class Person { 4 | private String firstName; 5 | private String lastName; 6 | private int age; 7 | 8 | public Person() { 9 | this.firstName = ""; 10 | this.lastName = ""; 11 | this.age = 0; 12 | } 13 | 14 | public Person(String firstName, String lastName, int age) { 15 | this.firstName = firstName; 16 | this.lastName = lastName; 17 | this.age = age; 18 | } 19 | 20 | public String getFirstName() { 21 | return firstName; 22 | } 23 | 24 | public void setFirstName(String firstName) { 25 | this.firstName = firstName; 26 | } 27 | 28 | public String getLastName() { 29 | return lastName; 30 | } 31 | 32 | public void setLastName(String lastName) { 33 | this.lastName = lastName; 34 | } 35 | 36 | public int getAge() { 37 | return age; 38 | } 39 | 40 | public void setAge(int age) { 41 | this.age = age; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /TableViewDemo/src/application/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-family: 'Arial'; 3 | -fx-font-size: 18px; 4 | -fx-font-style: normal; 5 | -fx-font-weight: normal; 6 | } -------------------------------------------------------------------------------- /TextAreaDemo/bin/application/FXUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TextAreaDemo/bin/application/FXUtils.class -------------------------------------------------------------------------------- /TextAreaDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TextAreaDemo/bin/application/Main.class -------------------------------------------------------------------------------- /TextAreaDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } -------------------------------------------------------------------------------- /TextAreaDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TextAreaDemo/src/application/FXUtils.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import java.io.FileInputStream; 4 | import java.io.FileNotFoundException; 5 | 6 | import javafx.geometry.Insets; 7 | import javafx.geometry.Pos; 8 | import javafx.scene.Node; 9 | import javafx.scene.control.Button; 10 | import javafx.scene.image.Image; 11 | import javafx.scene.image.ImageView; 12 | import javafx.scene.layout.HBox; 13 | import javafx.scene.layout.VBox; 14 | 15 | public class FXUtils { 16 | 17 | public static HBox createHBox(Node... children) { 18 | HBox hbox = new HBox(children); 19 | hbox.setAlignment(Pos.BASELINE_CENTER); 20 | hbox.setPadding(new Insets(10)); 21 | hbox.setSpacing(10); 22 | 23 | return hbox; 24 | } 25 | 26 | public static VBox createVBox(Node... children) { 27 | VBox vbox = new VBox(children); 28 | vbox.setAlignment(Pos.BASELINE_CENTER); 29 | vbox.setPadding(new Insets(10)); 30 | vbox.setSpacing(10); 31 | 32 | return vbox; 33 | } 34 | 35 | public static Button createButton(String text) { 36 | Button button = new Button(text); 37 | return button; 38 | } 39 | 40 | public static Button createButtonWithIcon(String text, String url) throws FileNotFoundException { 41 | Button button = new Button(); 42 | FileInputStream input = new FileInputStream(url); 43 | Image image = new Image(input); 44 | ImageView imageView = new ImageView(image); 45 | button.setText(text); 46 | button.setGraphic(imageView); 47 | return button; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /TextAreaDemo/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.scene.Scene; 5 | import javafx.scene.control.TextArea; 6 | import javafx.scene.layout.BorderPane; 7 | import javafx.stage.Stage; 8 | 9 | public class Main extends Application { 10 | 11 | private TextArea textArea; 12 | 13 | @Override 14 | public void start(Stage primaryStage) { 15 | try { 16 | primaryStage.setTitle("TextArea Demo"); 17 | BorderPane root = new BorderPane(); 18 | 19 | textArea = new TextArea(); 20 | textArea.setWrapText(true); 21 | textArea.setEditable(false); 22 | textArea.appendText("This is some text"); 23 | 24 | String text = textArea.getText(); 25 | System.out.println(text); 26 | 27 | root.setTop(textArea); 28 | 29 | Scene scene = new Scene(root, 400, 400); 30 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 31 | primaryStage.setScene(scene); 32 | primaryStage.show(); 33 | } catch (Exception e) { 34 | e.printStackTrace(); 35 | } 36 | } 37 | 38 | public static void main(String[] args) { 39 | launch(args); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /TextAreaDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 14px; 3 | } -------------------------------------------------------------------------------- /TextDemo/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TextDemo/bin/application/Main.class -------------------------------------------------------------------------------- /TextDemo/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /TextDemo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TextDemo/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.scene.Scene; 5 | import javafx.scene.effect.BoxBlur; 6 | import javafx.scene.layout.BorderPane; 7 | import javafx.scene.paint.Color; 8 | import javafx.scene.text.Font; 9 | import javafx.scene.text.FontWeight; 10 | import javafx.scene.text.Text; 11 | import javafx.scene.text.TextAlignment; 12 | import javafx.stage.Stage; 13 | 14 | 15 | public class Main extends Application { 16 | @Override 17 | public void start(Stage primaryStage) { 18 | try { 19 | primaryStage.setTitle("Text Demo"); 20 | BorderPane root = new BorderPane(); 21 | 22 | Text text = new Text("This is some longer text that will wrap at a predetermined pixel width"); 23 | 24 | text.setFont(Font.font("Roboto Black", FontWeight.BOLD, 36)); 25 | 26 | text.setFill(Color.YELLOW); 27 | 28 | text.setStroke(Color.GREEN); 29 | 30 | text.setStrokeWidth(1.5); 31 | 32 | //text.setStrikethrough(true); 33 | 34 | //text.setUnderline(true); 35 | 36 | //DropShadow shadow = new DropShadow(); 37 | //text.setEffect(shadow); 38 | 39 | //text.setEffect(new Reflection()); 40 | 41 | //text.setEffect(new BoxBlur()); 42 | 43 | text.setWrappingWidth(500); 44 | 45 | text.setTextAlignment(TextAlignment.JUSTIFY); 46 | 47 | 48 | 49 | root.setCenter(text); 50 | 51 | Scene scene = new Scene(root,600,400); 52 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); 53 | primaryStage.setScene(scene); 54 | primaryStage.show(); 55 | } catch(Exception e) { 56 | e.printStackTrace(); 57 | } 58 | } 59 | 60 | public static void main(String[] args) { 61 | launch(args); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /TextDemo/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /TextFieldExplorer/bin/application/Main$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TextFieldExplorer/bin/application/Main$1.class -------------------------------------------------------------------------------- /TextFieldExplorer/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TextFieldExplorer/bin/application/Main.class -------------------------------------------------------------------------------- /TextFieldExplorer/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /TextFieldExplorer/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TextFieldExplorer/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.event.ActionEvent; 5 | import javafx.event.EventHandler; 6 | import javafx.scene.Scene; 7 | import javafx.scene.control.TextField; 8 | import javafx.scene.layout.HBox; 9 | import javafx.stage.Stage; 10 | 11 | public class Main extends Application { 12 | 13 | @Override 14 | public void start(Stage primaryStage) throws Exception { 15 | primaryStage.setTitle("TextField Explorer"); 16 | 17 | // 1. Create new TextField 18 | TextField textField = new TextField(); 19 | 20 | // 2. Set Prompt Text 21 | textField.setPromptText("Enter some text"); 22 | textField.setFocusTraversable(false); 23 | 24 | // 3. Set On Action 25 | textField.setOnAction(new EventHandler() { 26 | @Override 27 | public void handle(ActionEvent event) { 28 | System.out.println("Congratulations, you entered some text!"); 29 | 30 | // 4. Get Text from TextField 31 | System.out.println(textField.getText()); 32 | 33 | // 5. Set Text on TextField 34 | textField.setText("I replaced your text!"); 35 | } 36 | }); 37 | 38 | HBox hbox = new HBox(textField); 39 | 40 | Scene scene = new Scene(hbox, 500, 300); 41 | primaryStage.setScene(scene); 42 | primaryStage.show(); 43 | 44 | } 45 | 46 | public static void main(String[] args) { 47 | Application.launch(args); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /TextFieldExplorer/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /TitledPane Demo/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TitledPane Demo/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /TitledPane Demo/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/TitledPane Demo/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /TitledPane Demo/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /TitledPane Demo/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TitledPane Demo/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | MainView mainView = new MainView(primaryStage); 11 | mainView.show(); 12 | } 13 | 14 | public static void main(String[] args) { 15 | launch(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /TitledPane Demo/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /VBox Explorer/bin/application/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/VBox Explorer/bin/application/Main.class -------------------------------------------------------------------------------- /VBox Explorer/bin/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /VBox Explorer/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /VBox Explorer/src/application/Main.java: -------------------------------------------------------------------------------- 1 | package application; 2 | 3 | import javafx.application.Application; 4 | import javafx.geometry.Pos; 5 | import javafx.scene.Scene; 6 | import javafx.scene.control.Button; 7 | import javafx.scene.layout.Priority; 8 | import javafx.scene.layout.VBox; 9 | import javafx.stage.Stage; 10 | 11 | public class Main extends Application { 12 | 13 | public static void main(String[] args) { 14 | launch(args); 15 | } 16 | 17 | @Override 18 | public void start(Stage primaryStage) { 19 | 20 | primaryStage.setTitle("VBox Explorer"); 21 | 22 | VBox vbox = new VBox(); 23 | vbox.setAlignment(Pos.TOP_RIGHT); 24 | 25 | Button button1 = new Button("One"); 26 | Button button2 = new Button("Two"); 27 | Button button3 = new Button("Three"); 28 | 29 | button1.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); 30 | button2.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); 31 | button3.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE); 32 | 33 | VBox.setVgrow(button1, Priority.ALWAYS); 34 | VBox.setVgrow(button2, Priority.ALWAYS); 35 | VBox.setVgrow(button3, Priority.ALWAYS); 36 | 37 | vbox.getChildren().addAll(button1, button2, button3); 38 | 39 | Scene scene = new Scene(vbox, 500, 300); 40 | primaryStage.setScene(scene); 41 | primaryStage.show(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /VBox Explorer/src/application/application.css: -------------------------------------------------------------------------------- 1 | /* JavaFX CSS - Leave this comment until you have at least create one rule which uses -fx-Property */ -------------------------------------------------------------------------------- /WindowEvents/bin/com/javacodejunkie/FXUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/WindowEvents/bin/com/javacodejunkie/FXUtils.class -------------------------------------------------------------------------------- /WindowEvents/bin/com/javacodejunkie/Launcher.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/WindowEvents/bin/com/javacodejunkie/Launcher.class -------------------------------------------------------------------------------- /WindowEvents/bin/com/javacodejunkie/MainView$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/WindowEvents/bin/com/javacodejunkie/MainView$1.class -------------------------------------------------------------------------------- /WindowEvents/bin/com/javacodejunkie/MainView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/WindowEvents/bin/com/javacodejunkie/MainView.class -------------------------------------------------------------------------------- /WindowEvents/bin/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 16.0px; 3 | } 4 | -------------------------------------------------------------------------------- /WindowEvents/build.fxbuild: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /WindowEvents/src/com/javacodejunkie/Launcher.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.stage.Stage; 5 | 6 | public class Launcher extends Application { 7 | 8 | @Override 9 | public void start(Stage primaryStage) { 10 | MainView mainView = new MainView(primaryStage); 11 | mainView.show(); 12 | } 13 | 14 | public static void main(String[] args) { 15 | launch(args); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /WindowEvents/src/com/javacodejunkie/MainView.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import java.util.Optional; 4 | 5 | import javafx.application.Platform; 6 | import javafx.event.EventHandler; 7 | import javafx.scene.Scene; 8 | import javafx.scene.control.Alert; 9 | import javafx.scene.control.Alert.AlertType; 10 | import javafx.scene.control.ButtonType; 11 | import javafx.scene.layout.BorderPane; 12 | import javafx.stage.Stage; 13 | import javafx.stage.WindowEvent; 14 | 15 | public class MainView { 16 | 17 | public Stage stage; 18 | private BorderPane root; 19 | private Scene scene; 20 | 21 | public MainView(Stage stage) { 22 | this.stage = stage; 23 | initialize(); 24 | } 25 | 26 | private void initialize() { 27 | 28 | stage.setTitle("Java Code Junkie - Window Events"); 29 | root = new BorderPane(); 30 | scene = new Scene(root, 500, 300); 31 | stage.setScene(scene); 32 | 33 | // stage.addEventHandler(WindowEvent.ANY, new EventHandler() { 34 | // @Override 35 | // public void handle(WindowEvent event) { 36 | // System.out.println(event.getEventType()); 37 | // } 38 | // }); 39 | 40 | stage.setOnCloseRequest(new EventHandler() { 41 | @Override 42 | public void handle(WindowEvent event) { 43 | Alert alert = new Alert(AlertType.CONFIRMATION); 44 | alert.setTitle("Exit Program"); 45 | alert.setHeaderText("Confirm Exit"); 46 | alert.setContentText("Are you sure that you want to exit the program?"); 47 | 48 | Optional result = alert.showAndWait(); 49 | 50 | if (result.isPresent() && result.get() == ButtonType.OK) { 51 | Platform.exit(); 52 | } else { 53 | event.consume(); 54 | } 55 | } 56 | }); 57 | 58 | } 59 | 60 | public void show() { 61 | this.stage.show(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /WindowEvents/src/com/javacodejunkie/stylesheet.css: -------------------------------------------------------------------------------- 1 | .root { 2 | -fx-font-size: 16.0px; 3 | } 4 | -------------------------------------------------------------------------------- /ZuluTest/bin/com/javacodejunkie/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JavaCodeJunkie/javafx/f5d7cd29fb0570846cbdb5f898998f54e758f748/ZuluTest/bin/com/javacodejunkie/Main.class -------------------------------------------------------------------------------- /ZuluTest/src/com/javacodejunkie/Main.java: -------------------------------------------------------------------------------- 1 | package com.javacodejunkie; 2 | 3 | import javafx.application.Application; 4 | import javafx.scene.Scene; 5 | import javafx.scene.layout.BorderPane; 6 | import javafx.stage.Stage; 7 | 8 | public class Main extends Application { 9 | 10 | public static void main(String[] args) { 11 | launch(args); 12 | } 13 | 14 | @Override 15 | public void start(Stage primaryStage) throws Exception { 16 | BorderPane root = new BorderPane(); 17 | Scene scene = new Scene(root, 800, 600); 18 | primaryStage.setScene(scene); 19 | primaryStage.show(); 20 | } 21 | 22 | } 23 | --------------------------------------------------------------------------------