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" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="368303c6-28f7-4db0-afac-e5679385c10c" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" 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 default="true" id="368303c6-28f7-4db0-afac-e5679385c10c" name="Changes" comment="New project">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.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 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 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 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" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -44,18 +34,18 @@
|
|||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"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"
|
||||
<component name="PropertiesComponent">{
|
||||
"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"
|
||||
}
|
||||
}]]></component>
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src/main/resources/fr/alnotz/view" />
|
||||
|
@ -90,6 +80,19 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1688292143465</updated>
|
||||
</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 />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="New project" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="New project" />
|
||||
</component>
|
||||
</project>
|
|
@ -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 " +
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
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 */
|
||||
#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;
|
||||
}
|
||||
-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"?>
|
||||
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
|
||||
<?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"
|
||||
fx:controller="fr.alnotz.control.MainControl"
|
||||
prefHeight="400.0" prefWidth="600.0">
|
||||
<Label fx:id="mainLabel"/>
|
||||
fx:id="pane"
|
||||
fx:controller="fr.alnotz.control.MainControl">
|
||||
<ImageView fx:id="image"
|
||||
layoutX="100"
|
||||
fitWidth="600"/>
|
||||
<Label fx:id="mainLabel"
|
||||
layoutX="100"
|
||||
layoutY="10"/>
|
||||
<Button fx:id="mainButton"
|
||||
text="Click _here!"
|
||||
onAction="#onClick">
|
||||
</Button>
|
||||
</VBox>
|
||||
layoutX="300"
|
||||
layoutY="400"
|
||||
onAction="#onClick"/>
|
||||
</Pane>
|
||||
|
|
Loading…
Reference in a new issue