diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9a21084..07d1b89 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,22 +4,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -44,18 +34,18 @@
- {
+ "keyToString": {
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "SHARE_PROJECT_CONFIGURATION_FILES": "true",
+ "git-widget-placeholder": "master",
+ "last_opened_file_path": "/home/alnotz/Git/Alnotz/jfxui",
+ "project.structure.last.edited": "Modules",
+ "project.structure.proportion": "0.0",
+ "project.structure.side.proportion": "0.0"
}
-}]]>
+}
@@ -90,6 +80,19 @@
1688292143465
+
+
+ 1688836184660
+
+
+
+ 1688836184660
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/fr/alnotz/control/MainControl.java b/src/main/java/fr/alnotz/control/MainControl.java
index 020f797..2441a57 100644
--- a/src/main/java/fr/alnotz/control/MainControl.java
+++ b/src/main/java/fr/alnotz/control/MainControl.java
@@ -8,6 +8,8 @@ import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
+import javafx.scene.image.ImageView;
+import javafx.scene.layout.Pane;
import java.net.URL;
import java.util.ResourceBundle;
@@ -15,6 +17,10 @@ import java.util.ResourceBundle;
public class MainControl implements Initializable {
private boolean hasClicked = false;
@FXML
+ private Pane pane;
+ @FXML
+ private ImageView image;
+ @FXML
private Label mainLabel = null;
@FXML
private Button mainButton = null;
@@ -26,12 +32,11 @@ public class MainControl implements Initializable {
mainButton.setText("_Bye.");
hasClicked = true;
}
-
}
@Override
@FXML
- public void initialize(URL url, ResourceBundle resourceBundle) {
+ public void initialize(URL url, ResourceBundle resourceBundle){
final String txt = "Hello, JavaFX " +
SystemInfo.javaVersion() +
", running on Java " +
diff --git a/src/main/java/fr/alnotz/gui/App.java b/src/main/java/fr/alnotz/gui/App.java
index 5cb7b68..a9bf4fd 100644
--- a/src/main/java/fr/alnotz/gui/App.java
+++ b/src/main/java/fr/alnotz/gui/App.java
@@ -3,8 +3,9 @@ package fr.alnotz.gui;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
+import javafx.scene.image.Image;
import javafx.scene.input.KeyEvent;
-import javafx.scene.layout.VBox;
+import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import java.io.IOException;
@@ -16,9 +17,14 @@ import java.nio.file.FileSystems;
* JavaFX App
*/
public class App extends Application {
-
+ /**
+ * JavaFX starter
+ * @param stage Main stage
+ * @throws IOException In/Out exception
+ */
@Override
public void start(Stage stage) throws IOException {
+ ///// Scene and style added /////
final String pathStr =
"src/main/resources/fr/alnotz/view/mainView.fxml";
final URL url = FileSystems
@@ -27,20 +33,24 @@ public class App extends Application {
.toUri()
.toURL();
final FXMLLoader fxmlLoader = new FXMLLoader(url);
- final VBox vbox = fxmlLoader.load();
- final Scene scene = new Scene(vbox,640,480);
+ final Pane pane = fxmlLoader.load();
+ final Scene scene = new Scene(pane,800,600);
final String cssStr =
"file:src/main/resources/fr/alnotz/style/mainStyle.css";
scene.getStylesheets().add(cssStr);
- stage.setTitle("Main window");
stage.setScene(scene);
+ ///// Stage loaded and events listened /////
+ stage.setTitle("Main window");
+ final String imgPath =
+ "file:src/main/resources/fr/alnotz/alnotz.png";
+ stage.getIcons().add(new Image(imgPath));
stage.addEventHandler(KeyEvent.KEY_PRESSED, keyEvent ->
- System.out.println("Key pressed: " +
- keyEvent.getCode().getChar())
+ System.out.println("Key pressed (code): " +
+ keyEvent.getCode().getCode())
);
stage.addEventHandler(KeyEvent.KEY_RELEASED, keyEvent ->
- System.out.println("Key released: " +
- keyEvent.getCode().getChar())
+ System.out.println("Key released (code): " +
+ keyEvent.getCode().getCode())
);
stage.show();
}
diff --git a/src/main/resources/fr/alnotz/alnotz.png b/src/main/resources/fr/alnotz/alnotz.png
new file mode 100644
index 0000000..a594725
Binary files /dev/null and b/src/main/resources/fr/alnotz/alnotz.png differ
diff --git a/src/main/resources/fr/alnotz/style/mainStyle.css b/src/main/resources/fr/alnotz/style/mainStyle.css
index 53d4c39..beb4f90 100644
--- a/src/main/resources/fr/alnotz/style/mainStyle.css
+++ b/src/main/resources/fr/alnotz/style/mainStyle.css
@@ -1,8 +1,21 @@
/** Main style Sheet */
-#mainButton {
- -fx-background-color: #101010;
+#pane {
+ -fx-background-color: black;
+}
+#mainLabel {
-fx-text-fill: #d0d0d0;
- -fx-padding: 50;
- -fx-pref-width: 300;
- -fx-pref-height: 200;
-}
\ No newline at end of file
+ -fx-font-size: 2em;
+}
+
+#image{
+ -fx-image: url(../alnotz.png);
+
+}
+#mainButton {
+ -fx-background-color: #303030;
+ -fx-text-fill: #d0d0d0;
+ -fx-font-size: 2em;
+ -fx-padding: 10;
+ -fx-pref-width: 200;
+ -fx-pref-height: 100;
+}
diff --git a/src/main/resources/fr/alnotz/view/mainView.fxml b/src/main/resources/fr/alnotz/view/mainView.fxml
index 8208049..aa5f774 100644
--- a/src/main/resources/fr/alnotz/view/mainView.fxml
+++ b/src/main/resources/fr/alnotz/view/mainView.fxml
@@ -1,17 +1,23 @@
-
-
+
-
+
-
+ fx:id="pane"
+ fx:controller="fr.alnotz.control.MainControl">
+
+
-
+ layoutX="300"
+ layoutY="400"
+ onAction="#onClick"/>
+