-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from technagreek/baseVersion
Base version of this sample JavaFX application
- Loading branch information
Showing
20 changed files
with
543 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# enchald | ||
Java FX basic framework which separates menu, basic status bar and basic modules. | ||
|
||
Intention is to provide basic sample framework for someone starting on Java FX. | ||
|
||
JDK version used is 1.8.0.271 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.technagreek</groupId> | ||
<artifactId>enchald</artifactId> | ||
<version>1.0.0.0</version> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.7.0</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<mainClass>org.technagreek.java.enchald.main.AppLauncher</mainClass> | ||
</manifest> | ||
</archive> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>make-assembly</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
<resources> | ||
<resource> | ||
<filtering>false</filtering> | ||
<directory>src/main/java</directory> | ||
<includes> | ||
<include>**/*.fxml</include> | ||
</includes> | ||
</resource> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<includes> | ||
<include>**/*.properties</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
</build> | ||
</project> |
15 changes: 15 additions & 0 deletions
15
src/main/java/org/technagreek/java/enchald/core/help/About.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?language javascript?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.layout.AnchorPane?> | ||
<?import javafx.scene.text.Font?> | ||
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" fx:id="AboutPane" prefHeight="210.0" prefWidth="551.0" | ||
xmlns="http://javafx.com/javafx/10.0.2-internal"> | ||
<Label layoutX="54.0" layoutY="65.0" prefHeight="16.0" prefWidth="327.0" text="Enchald sample for Java FX"/> | ||
<Label layoutX="54.0" layoutY="96.0" text="v1.0.0.0"/> | ||
<Label layoutX="54.0" layoutY="31.0" text="About"> | ||
<font> | ||
<Font size="14.0"/> | ||
</font> | ||
</Label> | ||
</AnchorPane> |
16 changes: 16 additions & 0 deletions
16
src/main/java/org/technagreek/java/enchald/core/menubar/MenuBar.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.control.*?> | ||
<?import javafx.scene.layout.BorderPane?> | ||
<MenuBar xmlns:fx="http://javafx.com/fxml/1" BorderPane.alignment="CENTER" | ||
xmlns="http://javafx.com/javafx/10.0.2-internal" | ||
fx:controller="org.technagreek.java.enchald.core.menubar.MenuBarController"> | ||
<Menu mnemonicParsing="false" text="File"> | ||
<MenuItem mnemonicParsing="false" onAction="#showSample1" text="Sample 1"/> | ||
<MenuItem mnemonicParsing="false" onAction="#showSample2" text="Sample 2"/> | ||
<MenuItem mnemonicParsing="false" onAction="#onClickCloseMenu" text="Close"/> | ||
</Menu> | ||
<Menu mnemonicParsing="false" text="Help"> | ||
<MenuItem mnemonicParsing="false" onAction="#showAbout" text="About"/> | ||
</Menu> | ||
</MenuBar> |
43 changes: 43 additions & 0 deletions
43
src/main/java/org/technagreek/java/enchald/core/menubar/MenuBarController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.technagreek.java.enchald.core.menubar; | ||
|
||
import javafx.application.Platform; | ||
import javafx.event.Event; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.layout.AnchorPane; | ||
import javafx.scene.layout.BorderPane; | ||
import org.technagreek.java.enchald.main.AppLauncher; | ||
import org.technagreek.java.enchald.main.MainApplication; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
|
||
public class MenuBarController { | ||
public void showSample1(Event event) throws IOException { | ||
BorderPane mainPanel = AppLauncher.getMainModule().getMainPane(); | ||
URL sample1FXML = this.getClass().getResource("../../modules/sample1/sample1.fxml"); | ||
|
||
FXMLLoader loader = new FXMLLoader(sample1FXML); | ||
|
||
AnchorPane centerScene = loader.load(); | ||
mainPanel.setCenter(centerScene); | ||
} | ||
|
||
public void showSample2(Event event) throws IOException { | ||
BorderPane mainPanel = AppLauncher.getMainModule().getMainPane(); | ||
URL sample1FXML = this.getClass().getResource("../../modules/sample2/sample2.fxml"); | ||
|
||
FXMLLoader loader = new FXMLLoader(sample1FXML); | ||
|
||
AnchorPane centerScene = loader.load(); | ||
mainPanel.setCenter(centerScene); | ||
} | ||
|
||
public void showAbout(Event event) throws IOException { | ||
MainApplication.showAbout(); | ||
} | ||
|
||
public void onClickCloseMenu(Event event) { | ||
Platform.exit(); | ||
System.exit(0); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/org/technagreek/java/enchald/core/module/BaseModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.technagreek.java.enchald.core.module; | ||
|
||
import java.util.HashMap; | ||
|
||
public interface BaseModule { | ||
String getName(); | ||
|
||
HashMap<String, String> getParameterSet(); | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/org/technagreek/java/enchald/core/module/MainModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.technagreek.java.enchald.core.module; | ||
|
||
import javafx.scene.control.ButtonType; | ||
import javafx.scene.layout.BorderPane; | ||
import javafx.scene.paint.Color; | ||
|
||
public interface MainModule extends BaseModule { | ||
|
||
BorderPane getMainPane(); | ||
|
||
void setStatusBarText(String StatusText); | ||
|
||
void setStatusBarText(String text, Color textColor); | ||
|
||
void displayMessage(String msg); | ||
|
||
void displayMessage(String title, String msg); | ||
|
||
void displayErrorMessage(String msg); | ||
|
||
void displayException(Exception e); | ||
|
||
ButtonType displayConfirmation(String msg, ButtonType... buttonTypes); | ||
|
||
void setProgressBarPercentage(Double i); | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/org/technagreek/java/enchald/core/statusbar/StatusBar.fxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.control.ProgressBar?> | ||
<?import javafx.scene.layout.*?> | ||
<GridPane xmlns:fx="http://javafx.com/fxml/1" | ||
xmlns="http://javafx.com/javafx/10.0.2-internal" alignment="CENTER_LEFT" | ||
maxHeight="1.7976931348623157E308" | ||
maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="34.0" | ||
|
||
fx:controller="org.technagreek.java.enchald.core.statusbar.StatusBarController"> | ||
<columnConstraints> | ||
<ColumnConstraints hgrow="ALWAYS" percentWidth="90.0"/> | ||
<ColumnConstraints hgrow="ALWAYS" percentWidth="10.0"/> | ||
</columnConstraints> | ||
<rowConstraints> | ||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> | ||
</rowConstraints> | ||
<Label fx:id="statusBarText" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"/> | ||
<ProgressBar fx:id="statusBarProgress" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" | ||
progress="0.0" GridPane.columnIndex="1"/> | ||
</GridPane> |
38 changes: 38 additions & 0 deletions
38
src/main/java/org/technagreek/java/enchald/core/statusbar/StatusBarController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.technagreek.java.enchald.core.statusbar; | ||
|
||
import javafx.application.Platform; | ||
import javafx.fxml.FXML; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.control.ProgressBar; | ||
import javafx.scene.paint.Color; | ||
|
||
public class StatusBarController { | ||
@FXML | ||
Label statusBarText; | ||
@FXML | ||
ProgressBar statusBarProgress; | ||
|
||
public static String convertToHex(final Color color) { | ||
return String.format( | ||
"#%02X%02X%02X", | ||
(int) (color.getRed() * 255), | ||
(int) (color.getGreen() * 255), | ||
(int) (color.getBlue() * 255)); | ||
} | ||
|
||
public void setStatusBarText(String StatusText) { | ||
statusBarText.setText(StatusText); | ||
} | ||
|
||
public void setStatusBarText(String StatusText, Color textColor) { | ||
Platform.runLater( | ||
() -> { | ||
statusBarText.setText(StatusText); | ||
statusBarText.setStyle("-fx-text-fill: " + convertToHex(textColor)); | ||
}); | ||
} | ||
|
||
public void updateProgress(Double progressPercentage) { | ||
statusBarProgress.setProgress(progressPercentage); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/org/technagreek/java/enchald/main/AppLauncher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.technagreek.java.enchald.main; | ||
|
||
import javafx.application.Application; | ||
import org.technagreek.java.enchald.core.module.MainModule; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.logging.LogManager; | ||
import java.util.logging.Logger; | ||
|
||
public final class AppLauncher { | ||
private static final Logger logger = Logger.getLogger(AppLauncher.class.getName()); | ||
private static MainModule mainModule; | ||
|
||
public static void main(final String[] args) { | ||
try { | ||
InputStream in = | ||
Thread.currentThread().getContextClassLoader().getResourceAsStream("logging.properties"); | ||
LogManager.getLogManager().readConfiguration(in); | ||
} catch (SecurityException | IOException e1) { | ||
e1.printStackTrace(); | ||
} | ||
|
||
logger.info("Starting GUI"); | ||
Application.launch(MainApplication.class, args); | ||
} | ||
|
||
public static MainModule getMainModule() { | ||
return mainModule; | ||
} | ||
|
||
public static void setMainModule(MainModule mainModule) { | ||
AppLauncher.mainModule = mainModule; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.layout.BorderPane?> | ||
<?import javafx.scene.layout.Pane?> | ||
<?import javafx.scene.Scene?> | ||
<Scene xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/10.0.2-internal" | ||
fx:controller="org.technagreek.java.enchald.main.MainController"> | ||
<BorderPane prefHeight="556.0" prefWidth="1000.0"> | ||
<top> | ||
<fx:include fx:id="menuBar" source="../core/menubar/MenuBar.fxml"/> | ||
</top> | ||
<center> | ||
<Pane id="centerScene" BorderPane.alignment="CENTER"> | ||
<Label layoutX="173.0" layoutY="100.0" prefHeight="16.0" prefWidth="299.0" text="Welcome To Enchald!"/> | ||
</Pane> | ||
</center> | ||
<bottom> | ||
<fx:include fx:id="statusBar" source="../core/statusbar/StatusBar.fxml"/> | ||
</bottom> | ||
</BorderPane> | ||
</Scene> |
Oops, something went wrong.