/* Files Removed */ -None /* Files Added */ -windowOpener.java /* Removed functions */ -None /* Added functions */ -Not function yet = added textfields for Nickname and realname /* File: windowOpener.java */ -Added new helper class -Added two public methodes -Added function (1) to open a second window -Added function (2) to open a new main window -Added javadoc /* File: menuCloser.java */ -Added javadoc -cleaned code /* File: prefrence.fxml*/ -Added a new design -Added textfields for nickname and realname -Added label for themes /* File: prefrence.css */ -Added new ids and classes -cleaned code /* Other Files */ -cleaned code Today I added a new helper class witch is supposed to help opening new second windows and main windows, also added the javadoc. Javadoc was also added to the other helper classes. Redesigned the prefrence window and added Textfields for nickname and realname. Still to add: function to get and set the nickname and realname.main
parent
a7fd3c173e
commit
a2733072b2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,42 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon?>
|
||||
<?import java.lang.String?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.prefrenceController">
|
||||
<AnchorPane prefHeight="400.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.prefrenceController">
|
||||
<BorderPane id="backgroundBorderPane" layoutX="67.0" layoutY="54.0" prefHeight="200.0" prefWidth="200.0" styleClass="background" stylesheets="@prefrence.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<top>
|
||||
<BorderPane onMouseDragged="#dragged" onMousePressed="#pressed" prefHeight="25.0" prefWidth="600.0" styleClass="topbar" stylesheets="@prefrence.css" BorderPane.alignment="CENTER">
|
||||
<left>
|
||||
<HBox id="lefttopbar" prefHeight="25.0" prefWidth="368.0" styleClass="topbar"
|
||||
stylesheets="@prefrence.css" BorderPane.alignment="CENTER">
|
||||
<HBox id="lefttopbar" prefHeight="25.0" prefWidth="368.0" styleClass="topbar" stylesheets="@prefrence.css" BorderPane.alignment="CENTER">
|
||||
<opaqueInsets>
|
||||
<Insets/>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
<Label text="Prefrences" textFill="WHITE">
|
||||
<padding>
|
||||
<Insets left="10.0" top="4.0"/>
|
||||
<Insets left="10.0" top="4.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
</HBox>
|
||||
</left>
|
||||
<right>
|
||||
<HBox id="lefttopbar" alignment="CENTER_RIGHT" prefHeight="25.0" prefWidth="230.0" styleClass="topbar"
|
||||
stylesheets="@prefrence.css" BorderPane.alignment="CENTER">
|
||||
<HBox id="lefttopbar" alignment="CENTER_RIGHT" prefHeight="25.0" prefWidth="230.0" styleClass="topbar" stylesheets="@prefrence.css" BorderPane.alignment="CENTER">
|
||||
<opaqueInsets>
|
||||
<Insets/>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
<padding>
|
||||
<Insets bottom="2.0" left="5.0" right="5.0" top="2.0"/>
|
||||
<Insets bottom="2.0" left="5.0" right="5.0" top="2.0" />
|
||||
</padding>
|
||||
<FontAwesomeIcon fill="#f20000" iconName="CLOSE" onMousePressed="#closeButtonClicked" scaleX="1.1"
|
||||
scaleY="1.1" scaleZ="1.1" selectionEnd="0" selectionFill="#f20000"/>
|
||||
<FontAwesomeIcon fill="#f20000" iconName="CLOSE" onMousePressed="#closeButtonClicked" scaleX="1.1" scaleY="1.1" scaleZ="1.1" selectionEnd="0" selectionFill="#f20000" />
|
||||
</HBox>
|
||||
</right>
|
||||
</BorderPane>
|
||||
</top></BorderPane>
|
||||
</top>
|
||||
<center>
|
||||
<BorderPane prefHeight="380.0" prefWidth="800.0" BorderPane.alignment="CENTER">
|
||||
<top>
|
||||
<VBox prefHeight="376.0" prefWidth="800.0" BorderPane.alignment="CENTER">
|
||||
<Pane prefHeight="10.0" prefWidth="800.0"/>
|
||||
<Pane id="menuName1Pane" prefHeight="23.0" prefWidth="800.0" stylesheets="@prefrence.css">
|
||||
<styleClass>
|
||||
<String fx:value="background"/>
|
||||
<String fx:value="menu"/>
|
||||
</styleClass>
|
||||
<Label alignment="CENTER" layoutX="354.0" layoutY="1.0" stylesheets="@prefrence.css"
|
||||
text="Personalisieren" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="14.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
</Pane>
|
||||
<Pane id="menu1MainPane" prefHeight="150.0" prefWidth="800.0" styleClass="background"
|
||||
stylesheets="@prefrence.css">
|
||||
<HBox prefHeight="150.0" prefWidth="800.0" stylesheets="@prefrence.css">
|
||||
<Pane prefHeight="150.0" prefWidth="270.0" styleClass="background"
|
||||
stylesheets="@prefrence.css">
|
||||
<Label layoutX="104.0" layoutY="14.0" text="Nickname" textFill="WHITE"/>
|
||||
<TextField id="nicknameField" layoutX="34.0" layoutY="32.0" prefHeight="26.0"
|
||||
prefWidth="200.0" stylesheets="@prefrence.css"/>
|
||||
<Label layoutX="84.0" layoutY="90.0" text="Vor & Nachname" textFill="WHITE"/>
|
||||
<TextField id="nicknameField" layoutX="34.0" layoutY="109.0" prefHeight="26.0"
|
||||
prefWidth="200.0" stylesheets="@prefrence.css"/>
|
||||
</Pane>
|
||||
<Pane prefHeight="150.0" prefWidth="270.0" styleClass="background"
|
||||
stylesheets="@prefrence.css">
|
||||
<Label layoutX="114.0" layoutY="14.0" text="Design" textFill="WHITE"/>
|
||||
</Pane>
|
||||
<Pane prefHeight="150.0" prefWidth="270.0" styleClass="background"
|
||||
stylesheets="@prefrence.css"/>
|
||||
</HBox>
|
||||
</Pane>
|
||||
<Pane prefHeight="13.0" prefWidth="800.0"/>
|
||||
<Pane id="menuName1Pane" prefHeight="23.0" prefWidth="800.0" stylesheets="@prefrence.css">
|
||||
<styleClass>
|
||||
<String fx:value="background"/>
|
||||
<String fx:value="menu"/>
|
||||
</styleClass>
|
||||
<Label alignment="CENTER" layoutX="382.0" layoutY="2.0" stylesheets="@prefrence.css"
|
||||
text="Other" textFill="WHITE">
|
||||
<font>
|
||||
<Font size="14.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
</Pane>
|
||||
<Pane prefHeight="159.0" prefWidth="800.0">
|
||||
<HBox prefHeight="162.0" prefWidth="800.0" styleClass="background"
|
||||
stylesheets="@prefrence.css"/>
|
||||
</Pane>
|
||||
</VBox>
|
||||
</top>
|
||||
</BorderPane>
|
||||
</center></BorderPane>
|
||||
</AnchorPane>
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
package helper;
|
||||
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.geometry.Rectangle2D;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Screen;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.StageStyle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EventObject;
|
||||
|
||||
/**
|
||||
* @author <a href="http://lukasmartin.eu">Lukas Martin</a>
|
||||
* @version 1.1
|
||||
* @since 11.01
|
||||
*/
|
||||
public class windowOpener {
|
||||
|
||||
/**
|
||||
* @param pathFXML String of fxml file location.
|
||||
* @param title String of the title.
|
||||
* @param stageStyle StageStyle will set the style.
|
||||
* @param width Int for width.
|
||||
* @param height Int for height.
|
||||
* @throws IOException Exception if the path {@code pathFXML} is null or not fxml.
|
||||
* @author <a href="http://lukasmartin.eu">Lukas Martin</a>
|
||||
* @version 1.1
|
||||
* @since 11.01
|
||||
*
|
||||
*/
|
||||
public void newWindow(String pathFXML, String title, StageStyle stageStyle, Integer width, Integer height) throws IOException {
|
||||
Stage secStage = new Stage();
|
||||
if(height == 1080 && width == 1920) {
|
||||
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
|
||||
Parent scene = FXMLLoader.load(getClass().getResource(pathFXML));
|
||||
secStage.setScene(new Scene(scene, width, height));
|
||||
secStage.setTitle(title);
|
||||
secStage.centerOnScreen();
|
||||
secStage.initStyle(stageStyle);
|
||||
secStage.setX(primaryScreenBounds.getMinX());
|
||||
secStage.setY(primaryScreenBounds.getMinY());
|
||||
secStage.setWidth(primaryScreenBounds.getWidth());
|
||||
secStage.setHeight(primaryScreenBounds.getHeight());
|
||||
} else {
|
||||
Parent scene = FXMLLoader.load(getClass().getResource(pathFXML));
|
||||
secStage.setScene(new Scene(scene, width, height));
|
||||
secStage.setTitle(title);
|
||||
secStage.centerOnScreen();
|
||||
secStage.initStyle(stageStyle);
|
||||
}
|
||||
secStage.show();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param pathFXML String of fxml file location.
|
||||
* @param title String of the title.
|
||||
* @param width Int for width.
|
||||
* @param height Int for height.
|
||||
* @param eventObject eventObject to get the current {@code Stage}.
|
||||
* @throws IOException Exception if the path {@code pathFXML} is null or not fxml.
|
||||
* @author <a href="http://lukasmartin.eu">Lukas Martin</a>
|
||||
* @version 1.1
|
||||
* @since 11
|
||||
*/
|
||||
|
||||
public void newMainWindow(String pathFXML, String title, int width, int height, EventObject eventObject) throws IOException {
|
||||
if (height == 1080 && width == 1920) {
|
||||
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
|
||||
Stage stage = (Stage) ((Node) eventObject.getSource()).getScene().getWindow();
|
||||
Parent scene = FXMLLoader.load(getClass().getResource(pathFXML));
|
||||
stage.setScene(new Scene(scene, width, height));
|
||||
stage.setTitle(title);
|
||||
stage.centerOnScreen();
|
||||
stage.setX(primaryScreenBounds.getMinX());
|
||||
stage.setY(primaryScreenBounds.getMinY());
|
||||
stage.setWidth(primaryScreenBounds.getWidth());
|
||||
stage.setHeight(primaryScreenBounds.getHeight());
|
||||
stage.show();
|
||||
} else {
|
||||
Stage stage = (Stage) ((Node) eventObject.getSource()).getScene().getWindow();
|
||||
Parent scene = FXMLLoader.load(getClass().getResource(pathFXML));
|
||||
stage.setScene(new Scene(scene, width, height));
|
||||
stage.setTitle(title);
|
||||
stage.centerOnScreen();
|
||||
stage.show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue