├── .classpath ├── .gitignore ├── .project ├── .settings ├── org.eclipse.core.resources.prefs └── org.eclipse.jdt.core.prefs ├── LICENSE.txt ├── README.md ├── bin ├── malc │ └── layout.fxml ├── malc2 │ ├── UI.fxml │ └── UI.fxml.bak ├── malc3 │ ├── Sample.fxml │ └── TextArea.fxml └── resources │ └── icon.png ├── build.fxbuild └── src ├── bank ├── Controller.java ├── Main.java └── UI.fxml ├── bind ├── a.java ├── bill.java └── j.java ├── ex ├── BackSpace.java ├── EventHandlerDemo.fxml ├── EventHandlerDemoController.java ├── KeyboardExample.java ├── MainApp.java ├── Person.java └── ScrollBarPane.java ├── game ├── BallGame.java ├── BallGameController.java ├── GameModel.java ├── HideShowApp.java └── SingleClassNoXmlBallGame.java ├── james ├── AvcHmi.java ├── DataSource.java ├── Indicators.java ├── Minimal.java ├── PopupExample.java ├── SecondStage.java ├── ServiceSample.java ├── s.java └── testScheduledExecutorService.java ├── malc ├── Main.java └── layout.fxml ├── malc2 ├── Main.java ├── Methods.java ├── UI.fxml └── UI.fxml.bak ├── malc3 ├── DemoShowHide.java ├── Sample.fxml ├── Sample.java └── TextArea.fxml ├── resources ├── GameView.fxml ├── head.png ├── icon.png └── style.css └── uka ├── Account.java └── uka.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Package Files # 4 | *.jar 5 | *.war 6 | *.ear 7 | 8 | */bin 9 | *bin 10 | *.bin 11 | *bin -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | JavaFX-Exercises 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.xtext.ui.shared.xtextBuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.xtext.ui.shared.xtextNature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/bank/Controller.java=UTF-8 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.7 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.7 12 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 John Malc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | JavaFX 2 | ================ 3 | 4 | Java FX Exercises 5 | 6 | JavaFX is a cross platform GUI toolkit for Java, and is the successor to the Java Swing libraries. 7 | 8 | #### Installation 9 | 10 | If you already develop applications with Java, you probably don't need to download anything at all: JavaFX has been included with the standard JDK (Java Development Kit) bundle since JDK version 7u6 (August 2012). If you haven't updated your Java installation in a while, head to the Java download website for the latest version. 11 | 12 | ### Basic Framework Classes 13 | 14 | Creating a JavaFX program begins with the Application class, from which all JavaFX applications are extended. Your main class should call the launch() method, which will then call the init() method and then the start() method, wait for the application to finish, and then call the stop() method. Of these methods, only the start() method is abstract and must be overridden. 15 | 16 | The Stage class is the top level JavaFX container. When an Application is launched, an initial Stage is created and passed to the Application's start method. Stages control basic window properties such as title, icon, visibility, resizability, fullscreen mode, and decorations; the latter is configured using StageStyle. Additional Stages may be constructed as necessary. After a Stage is configured and the content is added, the show() method is called. 17 | 18 | Knowing all this, we can write a minimal example that launches a window in JavaFX: 19 | 20 | ``` 21 | import javafx.application.Application; 22 | import javafx.stage.Stage; 23 | 24 | public class Example1 extends Application 25 | { 26 | public static void main(String[] args) 27 | { 28 | launch(args); 29 | } 30 | 31 | public void start(Stage theStage) 32 | { 33 | theStage.setTitle("Hello, World!"); 34 | theStage.show(); 35 | } 36 | } 37 | ``` 38 | 39 | ### Structuring Content 40 | 41 | Content in JavaFX (such as text, images, and UI controls) is organized using a tree-like data structure known as a scene graph, which groups and arranges the elements of a graphical scene. 42 | 43 | A general element of a scene graph in JavaFX is called a Node. Every Node in a tree has a single "parent" node, with the exception of a special Node designated as the "root". A Group is a Node which can have many "child" Node elements. Graphical transformations (translation, rotation, and scale) and effects applied to a Group also apply to its children. Nodes can be styled using JavaFX Cascading Style Sheets (CSS), quite similar to the CSS used to format HTML documents. 44 | 45 | The Scene class contains all content for a scene graph, and requires a root Node to be set (in practice, this is often a Group). You can set the size of a Scene specifically; otherwise, the size of a Scene will be automatically calculated based on its content. A Scene object must be passed to the Stage (by the setScene() method) in order to be displayed. 46 | -------------------------------------------------------------------------------- /bin/malc/layout.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |