Skip to content

Commit a83f9be

Browse files
committed
Init
Restructured the project using Netbeans IDE and added a GUI using javaFX ( FXML Files ) and JFoenix library
1 parent c61bf2a commit a83f9be

35 files changed

+10404
-0
lines changed

build.xml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="UTF-8"?><!-- You may freely edit this file. See commented blocks below for --><!-- some examples of how to customize the build. --><!-- (If you delete it and reopen the project it will be recreated.) --><!-- By default, only the Clean and Build commands use this build script. --><project name="GeneticAlgorithm" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
2+
<description>Builds, tests, and runs the project GeneticAlgorithm.</description>
3+
<import file="nbproject/build-impl.xml"/>
4+
<!--
5+
6+
There exist several targets which are by default empty and which can be
7+
used for execution of your tasks. These targets are usually executed
8+
before and after some main targets. Those of them relevant for JavaFX project are:
9+
10+
-pre-init: called before initialization of project properties
11+
-post-init: called after initialization of project properties
12+
-pre-compile: called before javac compilation
13+
-post-compile: called after javac compilation
14+
-pre-compile-test: called before javac compilation of JUnit tests
15+
-post-compile-test: called after javac compilation of JUnit tests
16+
-pre-jfx-jar: called before FX SDK specific <fx:jar> task
17+
-post-jfx-jar: called after FX SDK specific <fx:jar> task
18+
-pre-jfx-deploy: called before FX SDK specific <fx:deploy> task
19+
-post-jfx-deploy: called after FX SDK specific <fx:deploy> task
20+
-pre-jfx-native: called just after -pre-jfx-deploy if <fx:deploy> runs in native packaging mode
21+
-post-jfx-native: called just after -post-jfx-deploy if <fx:deploy> runs in native packaging mode
22+
-post-clean: called after cleaning build products
23+
24+
(Targets beginning with '-' are not intended to be called on their own.)
25+
26+
Example of inserting a HTML postprocessor after javaFX SDK deployment:
27+
28+
<target name="-post-jfx-deploy">
29+
<basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/>
30+
<property name="jfx.deployment.html" location="${jfx.deployment.dir}${file.separator}${jfx.deployment.base}.html"/>
31+
<custompostprocess>
32+
<fileset dir="${jfx.deployment.html}"/>
33+
</custompostprocess>
34+
</target>
35+
36+
Example of calling an Ant task from JavaFX SDK. Note that access to JavaFX SDK Ant tasks must be
37+
initialized; to ensure this is done add the dependence on -check-jfx-sdk-version target:
38+
39+
<target name="-post-jfx-jar" depends="-check-jfx-sdk-version">
40+
<echo message="Calling jar task from JavaFX SDK"/>
41+
<fx:jar ...>
42+
...
43+
</fx:jar>
44+
</target>
45+
46+
For more details about JavaFX SDK Ant tasks go to
47+
http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm
48+
49+
For list of available properties check the files
50+
nbproject/build-impl.xml and nbproject/jfx-impl.xml.
51+
52+
-->
53+
</project>

build/built-jar.properties

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#Thu, 12 Mar 2020 21:31:48 +0100
2+
3+
4+
C\:\\Users\\user\\Documents\\NetBeansProjects\\GeneticAlgorithm=

build/classes/GA/SimpleDemo.fxml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import com.jfoenix.controls.JFXButton?>
4+
<?import com.jfoenix.controls.JFXSlider?>
5+
<?import com.jfoenix.controls.JFXTextArea?>
6+
<?import javafx.scene.control.Label?>
7+
<?import javafx.scene.effect.DropShadow?>
8+
<?import javafx.scene.layout.AnchorPane?>
9+
<?import javafx.scene.text.Font?>
10+
11+
<AnchorPane id="AnchorPane" prefHeight="600.0" prefWidth="800.0" style="-fx-background-color: #1e2761;" stylesheets="@../css/custom.css" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="GA.SimpleDemoController">
12+
<children>
13+
<Label layoutX="288.0" layoutY="14.0" text="Genetic Algorithm" textFill="#dddddd">
14+
<font>
15+
<Font name="Consolas Bold" size="24.0" />
16+
</font>
17+
</Label>
18+
<JFXSlider fx:id="numberOfIndividuals" layoutX="151.0" layoutY="152.0" prefHeight="14.0" prefWidth="500.0" value="10.0" />
19+
<Label layoutX="301.0" layoutY="120.0" text="Number of individual" textFill="#dddddd">
20+
<font>
21+
<Font name="Consolas Bold" size="18.0" />
22+
</font>
23+
</Label>
24+
<JFXSlider fx:id="numberOfGenes" layoutX="151.0" layoutY="219.0" prefHeight="14.0" prefWidth="500.0" value="5.0" />
25+
<Label layoutX="326.0" layoutY="187.0" prefHeight="22.0" prefWidth="149.0" text="Number of genes" textFill="#dddddd">
26+
<font>
27+
<Font name="Consolas Bold" size="18.0" />
28+
</font>
29+
</Label>
30+
<JFXButton fx:id="generator" buttonType="RAISED" layoutX="326.0" layoutY="261.0" prefHeight="40.0" prefWidth="150.0" ripplerFill="#7a2048" style="-fx-background-color: #408ec6;" text="Generate" textFill="#dddddd">
31+
<font>
32+
<Font name="Consolas Bold" size="18.0" />
33+
</font>
34+
</JFXButton>
35+
<JFXTextArea fx:id="result" editable="false" focusColor="#7a2048" focusTraversable="false" layoutX="51.0" layoutY="328.0" prefHeight="250.0" prefWidth="700.0" promptText="Results . . ." style="-fx-background-color: #ddd;" unFocusColor="#408ec6" AnchorPane.leftAnchor="51.0" AnchorPane.rightAnchor="49.0">
36+
<font>
37+
<Font name="Consolas" size="14.0" />
38+
</font>
39+
</JFXTextArea>
40+
<Label fx:id="nbrIndividuals" alignment="CENTER" layoutX="513.0" layoutY="116.0" prefHeight="30.0" prefWidth="75.0" textFill="#dddddd">
41+
<font>
42+
<Font name="Consolas Bold" size="14.0" />
43+
</font>
44+
</Label>
45+
<Label fx:id="nbrGenes" alignment="CENTER" layoutX="486.0" layoutY="183.0" prefHeight="30.0" prefWidth="75.0" textFill="#dddddd">
46+
<font>
47+
<Font name="Consolas Bold" size="14.0" />
48+
</font>
49+
</Label>
50+
<Label fx:id="nbrGenes" alignment="CENTER" focusTraversable="false" layoutX="510.0" layoutY="117.0" prefHeight="30.0" prefWidth="50.0" textFill="#dddddd">
51+
<font>
52+
<Font name="Consolas Bold" size="14.0" />
53+
</font>
54+
</Label>
55+
<Label fx:id="nbrIndiv" alignment="CENTER" focusTraversable="false" layoutX="485.0" layoutY="183.0" prefHeight="30.0" prefWidth="50.0" textFill="#dddddd">
56+
<font>
57+
<Font name="Consolas Bold" size="14.0" />
58+
</font>
59+
</Label>
60+
</children>
61+
<effect>
62+
<DropShadow />
63+
</effect>
64+
</AnchorPane>

build/classes/css/custom.css

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* Styling the slider track */
2+
.jfx-slider > .track {
3+
-fx-background-color: #ddd;
4+
}
5+
6+
/* Styling the slider thumb */
7+
.jfx-slider > .thumb {
8+
-fx-background-color: #7a2048;
9+
}
10+
11+
/* Styling the filled track */
12+
.jfx-slider > .colored-track {
13+
-fx-background-color: #7a2048;
14+
}
15+
16+
/* Styling the animated thumb */
17+
.jfx-slider > .animated-thumb {
18+
-fx-background-color: #7a2048;
19+
}
20+
21+
/* Styling the slider value text inside animated thumb */
22+
.jfx-slider .slider-value {
23+
-fx-fill: white;
24+
-fx-stroke: white;
25+
}

dist/GeneticAlgorithm.html

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<html><head>
2+
<SCRIPT src="./web-files/dtjava.js"></SCRIPT>
3+
<script>
4+
function launchApplication(jnlpfile) {
5+
dtjava.launch( {
6+
url : 'GeneticAlgorithm.jnlp',
7+
jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iR2VuZXRpY0FsZ29yaXRobS5qbmxwIj4NCiAgPGluZm9ybWF0aW9uPg0KICAgIDx0aXRsZT5HZW5ldGljQWxnb3JpdGhtPC90aXRsZT4NCiAgICA8dmVuZG9yPnVzZXI8L3ZlbmRvcj4NCiAgICA8ZGVzY3JpcHRpb24+bnVsbDwvZGVzY3JpcHRpb24+DQogICAgPG9mZmxpbmUtYWxsb3dlZC8+DQogIDwvaW5mb3JtYXRpb24+DQogIDxyZXNvdXJjZXM+DQogICAgPGoyc2UgdmVyc2lvbj0iMS42KyIgaHJlZj0iaHR0cDovL2phdmEuc3VuLmNvbS9wcm9kdWN0cy9hdXRvZGwvajJzZSIvPg0KICAgIDxqYXIgaHJlZj0iR2VuZXRpY0FsZ29yaXRobS5qYXIiIHNpemU9Ijg3OTIiIGRvd25sb2FkPSJlYWdlciIgLz4NCiAgICA8amFyIGhyZWY9ImxpYlxqZm9lbml4LTguMC44LmphciIgc2l6ZT0iMjcwODc3MiIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICA8L3Jlc291cmNlcz4NCiAgPGFwcGxldC1kZXNjICB3aWR0aD0iODAwIiBoZWlnaHQ9IjYwMCIgbWFpbi1jbGFzcz0iY29tLmphdmFmeC5tYWluLk5vSmF2YUZYRmFsbGJhY2siICBuYW1lPSJHZW5ldGljQWxnb3JpdGhtIiA+DQogICAgPHBhcmFtIG5hbWU9InJlcXVpcmVkRlhWZXJzaW9uIiB2YWx1ZT0iOC4wKyIvPg0KICA8L2FwcGxldC1kZXNjPg0KICA8amZ4OmphdmFmeC1kZXNjICB3aWR0aD0iODAwIiBoZWlnaHQ9IjYwMCIgbWFpbi1jbGFzcz0iR0EuR2VuZXRpY0FsZ29yaXRobSIgIG5hbWU9IkdlbmV0aWNBbGdvcml0aG0iIC8+DQogIDx1cGRhdGUgY2hlY2s9ImFsd2F5cyIvPg0KPC9qbmxwPg0K'
8+
},
9+
{
10+
javafx : '8.0+'
11+
},
12+
{}
13+
);
14+
return false;
15+
}
16+
</script>
17+
18+
<script>
19+
function javafxEmbedGA() {
20+
dtjava.embed(
21+
{
22+
id : 'GA',
23+
url : 'GeneticAlgorithm.jnlp',
24+
placeholder : 'javafx-app-placeholder',
25+
width : '800',
26+
height : '600',
27+
jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbn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
30+
javafx : '8.0+'
31+
},
32+
{}
33+
);
34+
}
35+
<!-- Embed FX application into web page once page is loaded -->
36+
dtjava.addOnloadCallback(javafxEmbedGA);
37+
</script>
38+
39+
</head><body>
40+
<h2>Test page for <b>GeneticAlgorithm</b></h2>
41+
<b>Webstart:</b> <a href='GeneticAlgorithm.jnlp' onclick="return launchApplication('GeneticAlgorithm.jnlp');">click to launch this app as webstart</a><br><hr><br>
42+
43+
<!-- Applet will be inserted here -->
44+
<div id='javafx-app-placeholder'></div>
45+
</body></html>

dist/GeneticAlgorithm.jnlp

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="GeneticAlgorithm.jnlp">
3+
<information>
4+
<title>GeneticAlgorithm</title>
5+
<vendor>user</vendor>
6+
<description>null</description>
7+
<offline-allowed/>
8+
</information>
9+
<resources>
10+
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
11+
<jar href="GeneticAlgorithm.jar" size="8792" download="eager" />
12+
<jar href="lib\jfoenix-8.0.8.jar" size="2708772" download="eager" />
13+
</resources>
14+
<applet-desc width="800" height="600" main-class="com.javafx.main.NoJavaFXFallback" name="GeneticAlgorithm" >
15+
<param name="requiredFXVersion" value="8.0+"/>
16+
</applet-desc>
17+
<jfx:javafx-desc width="800" height="600" main-class="GA.GeneticAlgorithm" name="GeneticAlgorithm" />
18+
<update check="always"/>
19+
</jnlp>

0 commit comments

Comments
 (0)