├── .gitignore ├── README.md ├── pom.xml └── src └── main ├── java └── com │ └── spartajet │ └── fxboot │ └── demo │ ├── MainController.java │ ├── controller │ └── MainStageController.java │ └── view │ ├── CustomSplash.java │ └── MainStageView.java └── resources ├── css └── MainStage.css └── view └── MainStage.fxml /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Java template 3 | # Compiled class file 4 | *.class 5 | 6 | # Log file 7 | *.log 8 | 9 | # BlueJ files 10 | *.ctxt 11 | 12 | # Mobile Tools for Java (J2ME) 13 | .mtj.tmp/ 14 | 15 | # Package Files # 16 | *.jar 17 | *.war 18 | *.ear 19 | *.zip 20 | *.tar.gz 21 | *.rar 22 | 23 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 24 | hs_err_pid* 25 | 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # javafx-boot-demo 2 | 这个是 javafx 和 springboot 的整合。具体见 http://blog.spartajet.com/2017/05/20/javafx-spring-boot-maven/ 3 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.spartajet 8 | javafx-boot-demo 9 | 1.0-SNAPSHOT 10 | 11 | 12 | UTF-8 13 | zh_CN 14 | 1.8 15 | ${java.version} 16 | 1.5.1.RELEASE 17 | 1.3.15 18 | 19 | 20 | 21 | 22 | org.springframework.boot 23 | spring-boot-starter-actuator 24 | ${spring.boot.version} 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-starter 29 | ${spring.boot.version} 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-starter-log4j2 34 | ${spring.boot.version} 35 | 36 | 37 | org.springframework.boot 38 | spring-boot-starter-test 39 | ${spring.boot.version} 40 | test 41 | 42 | 43 | de.roskenet 44 | springboot-javafx-support 45 | ${springboot-javafx-support.version} 46 | 47 | 48 | 49 | 50 | 51 | 52 | org.springframework.boot 53 | spring-boot-maven-plugin 54 | 55 | 56 | com.zenjava 57 | javafx-maven-plugin 58 | 59 | com.spartajet.fxboot.demo.MainController 60 | Spartajet 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | jitpack.io 72 | https://jitpack.io 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/main/java/com/spartajet/fxboot/demo/MainController.java: -------------------------------------------------------------------------------- 1 | package com.spartajet.fxboot.demo; 2 | 3 | import com.spartajet.fxboot.demo.view.MainStageView; 4 | import de.felixroske.jfxsupport.AbstractJavaFxApplicationSupport; 5 | import javafx.stage.Stage; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | 8 | /** 9 | * The type Main controller. 10 | * 11 | * @description 12 | * @create 2017 -05-20 下午1:45 13 | * @email spartajet.guo @gmail.com 14 | */ 15 | @SpringBootApplication 16 | public class MainController extends AbstractJavaFxApplicationSupport { 17 | 18 | /** 19 | * The entry point of application. 20 | * 21 | * @param args the input arguments 22 | */ 23 | public static void main(String[] args) { 24 | launchApp(MainController.class, MainStageView.class, args); 25 | } 26 | 27 | /** 28 | * Start. 29 | * 30 | * @param stage the stage 31 | * 32 | * @exception Exception the exception 33 | */ 34 | @Override 35 | public void start(Stage stage) throws Exception { 36 | super.start(stage); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/spartajet/fxboot/demo/controller/MainStageController.java: -------------------------------------------------------------------------------- 1 | package com.spartajet.fxboot.demo.controller; 2 | 3 | import de.felixroske.jfxsupport.FXMLController; 4 | import javafx.fxml.Initializable; 5 | 6 | import java.net.URL; 7 | import java.util.ResourceBundle; 8 | 9 | /** 10 | * @description 11 | * @create 2017-05-20 下午1:55 12 | * @email spartajet.guo@gmail.com 13 | */ 14 | @FXMLController 15 | public class MainStageController implements Initializable { 16 | 17 | /** 18 | * Called to initialize a controller after its root element has been 19 | * completely processed. 20 | * 21 | * @param location The location used to resolve relative paths for the root object, or 22 | * null if the location is not known. 23 | * @param resources The resources used to localize the root object, or null if 24 | */ 25 | public void initialize(URL location, ResourceBundle resources) { 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/spartajet/fxboot/demo/view/CustomSplash.java: -------------------------------------------------------------------------------- 1 | package com.spartajet.fxboot.demo.view; 2 | 3 | import de.felixroske.jfxsupport.SplashScreen; 4 | 5 | /** 6 | * @description 7 | * @create 2017-05-20 下午2:54 8 | * @email spartajet.guo@gmail.com 9 | */ 10 | public class CustomSplash extends SplashScreen { 11 | /** 12 | * Use your own splash image instead of the default one 13 | * 14 | * @return "/splash/javafx.png" 15 | */ 16 | @Override 17 | public String getImagePath() { 18 | return super.getImagePath(); 19 | } 20 | 21 | /** 22 | * Customize if the splash screen should be visible at all 23 | * 24 | * @return true by default 25 | */ 26 | @Override 27 | public boolean visible() { 28 | return super.visible(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/spartajet/fxboot/demo/view/MainStageView.java: -------------------------------------------------------------------------------- 1 | package com.spartajet.fxboot.demo.view; 2 | 3 | import de.felixroske.jfxsupport.AbstractFxmlView; 4 | import de.felixroske.jfxsupport.FXMLView; 5 | 6 | /** 7 | * @description 8 | * @create 2017-05-20 下午1:54 9 | * @email spartajet.guo@gmail.com 10 | */ 11 | @FXMLView(value = "/view/MainStage.fxml") 12 | public class MainStageView extends AbstractFxmlView { 13 | } 14 | -------------------------------------------------------------------------------- /src/main/resources/css/MainStage.css: -------------------------------------------------------------------------------- 1 | #mainBorderPane { 2 | -fx-pref-height: 400.0; 3 | -fx-pref-width: 600.0; 4 | } -------------------------------------------------------------------------------- /src/main/resources/view/MainStage.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 |
35 | 36 | 37 |