Scene adjusted
This commit is contained in:
parent
3a44535287
commit
5fdfb137c6
6 changed files with 90 additions and 53 deletions
|
@ -4,22 +4,12 @@
|
||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="368303c6-28f7-4db0-afac-e5679385c10c" name="Changes" comment="">
|
<list default="true" id="368303c6-28f7-4db0-afac-e5679385c10c" name="Changes" comment="New project">
|
||||||
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/java/fr/alnotz/control/MainControl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/fr/alnotz/control/MainControl.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/java/fr/alnotz/gui/App.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/fr/alnotz/gui/App.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/resources/fr/alnotz/style/mainStyle.css" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/fr/alnotz/style/mainStyle.css" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/resources/fr/alnotz/view/mainView.fxml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/fr/alnotz/view/mainView.fxml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/main/java/fr/alnotz/SystemInfo.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/main/java/fr/alnotz/control/MainControl.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/main/java/fr/alnotz/control/package-info.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/main/java/fr/alnotz/gui/App.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/main/java/fr/alnotz/gui/package-info.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/main/java/module-info.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/main/resources/fr/alnotz/style/mainStyle.css" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/main/resources/fr/alnotz/view/mainView.fxml" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
@ -44,18 +34,18 @@
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"git-widget-placeholder": "master",
|
"git-widget-placeholder": "master",
|
||||||
"last_opened_file_path": "/home/alnotz/Git/Alnotz/jfxui",
|
"last_opened_file_path": "/home/alnotz/Git/Alnotz/jfxui",
|
||||||
"project.structure.last.edited": "Modules",
|
"project.structure.last.edited": "Modules",
|
||||||
"project.structure.proportion": "0.0",
|
"project.structure.proportion": "0.0",
|
||||||
"project.structure.side.proportion": "0.0"
|
"project.structure.side.proportion": "0.0"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
<key name="MoveFile.RECENT_KEYS">
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
<recent name="$PROJECT_DIR$/src/main/resources/fr/alnotz/view" />
|
<recent name="$PROJECT_DIR$/src/main/resources/fr/alnotz/view" />
|
||||||
|
@ -90,6 +80,19 @@
|
||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1688292143465</updated>
|
<updated>1688292143465</updated>
|
||||||
</task>
|
</task>
|
||||||
|
<task id="LOCAL-00001" summary="New project">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1688836184660</created>
|
||||||
|
<option name="number" value="00001" />
|
||||||
|
<option name="presentableId" value="LOCAL-00001" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1688836184660</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="2" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="VcsManagerConfiguration">
|
||||||
|
<MESSAGE value="New project" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="New project" />
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -8,6 +8,8 @@ import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
@ -15,6 +17,10 @@ import java.util.ResourceBundle;
|
||||||
public class MainControl implements Initializable {
|
public class MainControl implements Initializable {
|
||||||
private boolean hasClicked = false;
|
private boolean hasClicked = false;
|
||||||
@FXML
|
@FXML
|
||||||
|
private Pane pane;
|
||||||
|
@FXML
|
||||||
|
private ImageView image;
|
||||||
|
@FXML
|
||||||
private Label mainLabel = null;
|
private Label mainLabel = null;
|
||||||
@FXML
|
@FXML
|
||||||
private Button mainButton = null;
|
private Button mainButton = null;
|
||||||
|
@ -26,12 +32,11 @@ public class MainControl implements Initializable {
|
||||||
mainButton.setText("_Bye.");
|
mainButton.setText("_Bye.");
|
||||||
hasClicked = true;
|
hasClicked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@FXML
|
@FXML
|
||||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
public void initialize(URL url, ResourceBundle resourceBundle){
|
||||||
final String txt = "Hello, JavaFX " +
|
final String txt = "Hello, JavaFX " +
|
||||||
SystemInfo.javaVersion() +
|
SystemInfo.javaVersion() +
|
||||||
", running on Java " +
|
", running on Java " +
|
||||||
|
|
|
@ -3,8 +3,9 @@ package fr.alnotz.gui;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.input.KeyEvent;
|
import javafx.scene.input.KeyEvent;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -16,9 +17,14 @@ import java.nio.file.FileSystems;
|
||||||
* JavaFX App
|
* JavaFX App
|
||||||
*/
|
*/
|
||||||
public class App extends Application {
|
public class App extends Application {
|
||||||
|
/**
|
||||||
|
* JavaFX starter
|
||||||
|
* @param stage Main stage
|
||||||
|
* @throws IOException In/Out exception
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage stage) throws IOException {
|
public void start(Stage stage) throws IOException {
|
||||||
|
///// Scene and style added /////
|
||||||
final String pathStr =
|
final String pathStr =
|
||||||
"src/main/resources/fr/alnotz/view/mainView.fxml";
|
"src/main/resources/fr/alnotz/view/mainView.fxml";
|
||||||
final URL url = FileSystems
|
final URL url = FileSystems
|
||||||
|
@ -27,20 +33,24 @@ public class App extends Application {
|
||||||
.toUri()
|
.toUri()
|
||||||
.toURL();
|
.toURL();
|
||||||
final FXMLLoader fxmlLoader = new FXMLLoader(url);
|
final FXMLLoader fxmlLoader = new FXMLLoader(url);
|
||||||
final VBox vbox = fxmlLoader.load();
|
final Pane pane = fxmlLoader.load();
|
||||||
final Scene scene = new Scene(vbox,640,480);
|
final Scene scene = new Scene(pane,800,600);
|
||||||
final String cssStr =
|
final String cssStr =
|
||||||
"file:src/main/resources/fr/alnotz/style/mainStyle.css";
|
"file:src/main/resources/fr/alnotz/style/mainStyle.css";
|
||||||
scene.getStylesheets().add(cssStr);
|
scene.getStylesheets().add(cssStr);
|
||||||
stage.setTitle("Main window");
|
|
||||||
stage.setScene(scene);
|
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 ->
|
stage.addEventHandler(KeyEvent.KEY_PRESSED, keyEvent ->
|
||||||
System.out.println("Key pressed: " +
|
System.out.println("Key pressed (code): " +
|
||||||
keyEvent.getCode().getChar())
|
keyEvent.getCode().getCode())
|
||||||
);
|
);
|
||||||
stage.addEventHandler(KeyEvent.KEY_RELEASED, keyEvent ->
|
stage.addEventHandler(KeyEvent.KEY_RELEASED, keyEvent ->
|
||||||
System.out.println("Key released: " +
|
System.out.println("Key released (code): " +
|
||||||
keyEvent.getCode().getChar())
|
keyEvent.getCode().getCode())
|
||||||
);
|
);
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
|
|
BIN
src/main/resources/fr/alnotz/alnotz.png
Normal file
BIN
src/main/resources/fr/alnotz/alnotz.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
|
@ -1,8 +1,21 @@
|
||||||
/** Main style Sheet */
|
/** Main style Sheet */
|
||||||
#mainButton {
|
#pane {
|
||||||
-fx-background-color: #101010;
|
-fx-background-color: black;
|
||||||
-fx-text-fill: #d0d0d0;
|
}
|
||||||
-fx-padding: 50;
|
#mainLabel {
|
||||||
-fx-pref-width: 300;
|
-fx-text-fill: #d0d0d0;
|
||||||
-fx-pref-height: 200;
|
-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;
|
||||||
}
|
}
|
|
@ -1,17 +1,23 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.scene.layout.VBox?>
|
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
|
<?import javafx.scene.layout.Pane?>
|
||||||
|
|
||||||
<VBox xmlns="http://javafx.com/javafx"
|
<?import javafx.scene.image.ImageView?>
|
||||||
|
<Pane xmlns="http://javafx.com/javafx"
|
||||||
xmlns:fx="http://javafx.com/fxml"
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
fx:controller="fr.alnotz.control.MainControl"
|
fx:id="pane"
|
||||||
prefHeight="400.0" prefWidth="600.0">
|
fx:controller="fr.alnotz.control.MainControl">
|
||||||
<Label fx:id="mainLabel"/>
|
<ImageView fx:id="image"
|
||||||
|
layoutX="100"
|
||||||
|
fitWidth="600"/>
|
||||||
|
<Label fx:id="mainLabel"
|
||||||
|
layoutX="100"
|
||||||
|
layoutY="10"/>
|
||||||
<Button fx:id="mainButton"
|
<Button fx:id="mainButton"
|
||||||
text="Click _here!"
|
text="Click _here!"
|
||||||
onAction="#onClick">
|
layoutX="300"
|
||||||
</Button>
|
layoutY="400"
|
||||||
</VBox>
|
onAction="#onClick"/>
|
||||||
|
</Pane>
|
||||||
|
|
Loading…
Reference in a new issue