redesign and new function in helper

redesigned the menu and also added new function in windowOpener for opening a new window with an exsisting Parent
main
Kaabp 5 years ago
parent d83cd2c427
commit 82cf3e7de0

@ -64,4 +64,14 @@
-fx-background-color: #252530;
-fx-border-color: #6b6868;
-fx-border-width: 0.5px 0.5px 0.5px 0px;
}
}
#welcomeLabel {
}
#searchBar {
-fx-background-color: #252530;
-fx-border-color: #6b6868;
-fx-border-width: 0.5px 0.5px 0.5px 0.5px;
-fx-text-fill: white;
-fx-border-radius: 8 8 8 8;
-fx-background-radius: 8 8 8 8;
}

@ -4,37 +4,29 @@
.background {
-fx-background-color: #252530;
}
.topbar {
-fx-background-color: #0b111a;
}
.menu {
-fx-border-color: #6b6868;
-fx-border-width: 0px 0px 0.5px 0px;
}
#lefttopbar {
}
#righttopbar {
}
#leftPane {
-fx-border-color: #6b6868;
-fx-border-width: 0.5px 0.5px 0.5px 0.5px;
}
#centrePane {
}
#submitButton {
}
#nicknameLabel {
-fx-border-color: #6b6868;
-fx-border-width: 0px 0px 0.5px 0px;
@ -56,4 +48,6 @@
}
#menu1MainPane {
}
#welcomeText {
}

@ -36,13 +36,13 @@
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon?>
<?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?>
<?import javafx.scene.text.Text?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" onKeyPressed="#pressedkey" prefHeight="680.0" prefWidth="1280.0" xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.homeController">
<BorderPane id="borderpane" layoutX="162.0" layoutY="64.0" prefHeight="200.0" prefWidth="200.0" stylesheets="@../css/home.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
@ -115,19 +115,35 @@
<center>
<AnchorPane onMouseClicked="#bodyOnClick" onMouseEntered="#bodyMouseEntred" prefHeight="627.0" prefWidth="1135.0" BorderPane.alignment="CENTER">
<Pane id="panehome" stylesheets="@../css/home.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<Text fill="WHITE" layoutX="492.0" layoutY="316.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Dashboard und so, lol.">
<font>
<Font size="30.0" />
</font>
</Text>
<VBox id="menuslide" fx:id="menuslideV" prefHeight="622.0" prefWidth="200.0" stylesheets="@../css/home.css" visible="false">
<Label fx:id="usernameMenuLabel" prefHeight="20.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" />
<JFXListCell id="buttonStammbaum" fx:id="buttonStammbaum" onMouseClicked="#buttonStammbaumClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Stammbaum" textFill="WHITE" />
<JFXListCell id="buttonPeople" fx:id="buttonPeople" onMouseClicked="#buttonPeopleClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="People" textFill="WHITE" />
<JFXListCell id="buttonPictrues" fx:id="buttonPictures" onMouseClicked="#buttonPicturesClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Pictures" textFill="WHITE" />
<JFXListCell id="buttonResearch" fx:id="buttoResearch" onMouseClicked="#buttonResearchClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Research " textFill="WHITE" />
<JFXListCell id="buttonMoney" fx:id="buttonMoney" onMouseClicked="#buttonMoneyClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Money" textFill="WHITE" />
<JFXListCell id="buttonOptions" fx:id="buttonOptions" onMouseClicked="#buttonOptionsClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Optionen" textFill="WHITE" />
<Pane prefHeight="34.0" prefWidth="198.0" styleClass="background" stylesheets="@../css/prefrence.css">
<padding>
<Insets left="10.0" />
</padding>
<Label id="labelSearch" fx:id="labelSearch" contentDisplay="CENTER" layoutX="74.0" layoutY="14.0" prefHeight="25.0" prefWidth="50.0" stylesheets="@../css/home.css" text="Search" textAlignment="CENTER" textFill="#71f86e">
<font>
<Font size="16.0" />
</font>
</Label>
</Pane>
<Pane prefHeight="52.0" prefWidth="198.0" stylesheets="@../css/home.css">
<TextField id="searchBar" layoutX="7.0" layoutY="11.0" prefHeight="31.0" prefWidth="185.0" styleClass="background" stylesheets="@../css/home.css" />
</Pane>
<Pane prefHeight="35.0" prefWidth="198.0">
<Label id="labelWindows" fx:id="labelWindows" contentDisplay="CENTER" layoutX="65.0" layoutY="7.0" prefHeight="23.0" prefWidth="68.0" stylesheets="@../css/home.css" text="Windows" textAlignment="CENTER" textFill="#71f86e">
<font>
<Font size="16.0" />
</font>
</Label>
</Pane>
<JFXListCell id="buttonStammbaum" fx:id="buttonStammbaum" alignment="CENTER" onMouseClicked="#buttonStammbaumClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Stammbaum" textFill="WHITE" />
<JFXListCell id="buttonResearch" fx:id="buttoResearch" alignment="CENTER" onMouseClicked="#buttonResearchClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Research " textFill="WHITE" />
<JFXListCell id="buttonPeople" fx:id="buttonPeople" alignment="CENTER" contentDisplay="CENTER" onMouseClicked="#buttonPeopleClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="People " textFill="WHITE" />
<JFXListCell id="buttonPictrues" fx:id="buttonPictures" alignment="CENTER" onMouseClicked="#buttonPicturesClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Pictures " textFill="WHITE" />
<JFXListCell id="buttonMoney" fx:id="buttonMoney" alignment="CENTER" contentDisplay="CENTER" onMouseClicked="#buttonMoneyClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Money " textFill="WHITE" />
<opaqueInsets>
<Insets />
</opaqueInsets>
</VBox>
<VBox id="filesmenu" fx:id="filesmenu" layoutX="57.0" onMouseExited="#filesOpenPaneExited" prefHeight="250.0" prefWidth="150.0" stylesheets="@../css/home.css" visible="false" />
<BorderPane id="optionPane" fx:id="optionsmenu" layoutX="91.0" onMouseEntered="#optionPaneEntered" onMouseExited="#optionPaneExited" prefHeight="245.0" prefWidth="148.0" visible="false">
@ -138,7 +154,7 @@
</center>
<bottom>
<VBox id="VboxOption1" prefHeight="30.0" prefWidth="147.0" stylesheets="@../css/home.css" BorderPane.alignment="CENTER">
<JFXListCell id="prefreceButtonOptionsMenu" onMouseClicked="#optionsTopMenuPrefrenceButton" prefHeight="33.0" prefWidth="184.0" styleClass="buttonTopBarMenus" stylesheets="@../css/home.css" text="Prefrences" />
<JFXListCell id="prefreceButtonOptionsMenu" fx:id="preferenceButton" onMouseClicked="#optionsTopMenuPrefrenceButton" prefHeight="33.0" prefWidth="184.0" styleClass="buttonTopBarMenus" stylesheets="@../css/home.css" text="Prefrences" />
</VBox>
</bottom>
</BorderPane>

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE preferences SYSTEM "http://java.sun.com/dtd/preferences.dtd">
<preferences EXTERNAL_XML_VERSION="1.0">
<root type="user">
<map/>
<node name="genealogieresearchtool">
<map/>
<node name="Test">
<map>
<entry key="name" value="Lukas Martin"/>
<entry key="username" value="Kaabp"/>
</map>
</node>
</node>
</root>
</preferences>

@ -4,14 +4,17 @@ import com.jfoenix.controls.JFXListCell;
import helper.menuCloser;
import helper.windowOpener;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.control.Label;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextFlow;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
@ -25,6 +28,7 @@ import java.util.prefs.Preferences;
public class homeController {
//Helper
menuCloser mCloser = new menuCloser(); //menu closer
Boolean sliderClicked = false; //Menu slider activated
@ -42,12 +46,17 @@ public class homeController {
@FXML private BorderPane hboxmen; //Unused
@FXML private BorderPane optionsmenu; //Options Menu Button
@FXML private VBox menuslideV; //Menu slider
@FXML private Label usernameMenuLabel; //Menu Slider Username Label
@FXML private TextFlow usernameTextFlow; //Menu Slider Username Label
@FXML private JFXListCell preferenceButton;
@FXML private Label labelSearch;
@FXML private Label labelWindows;
//const
double x,y; //x and y coordinates from monitor
Preferences pref0 = Preferences.userRoot().node("genealogieresearchtool/Test"); //Gets the user preferences
Preferences pref0 = Preferences.userRoot().node("genealogieresearchtool/Test"); //Gets the user preferences
preferenceController pcont = new preferenceController();
//top menu
@ -120,7 +129,6 @@ public class homeController {
mCloser.openMenu(menuslideV, filesmenu, optionsmenu, true); //Opens first given menu and closes the others
Stage stage = (Stage) ((Node) mouseEvent.getSource()).getScene().getWindow(); //Gets the current windows
menuslideV.prefHeightProperty().bind(stage.heightProperty()); //Bind the menu height to the current window height.
usernameMenuLabel.setText(pref0.get("username", "Max Mustermann"));
}
@ -164,9 +172,12 @@ public class homeController {
//Options Menu Opened Prefrence Button Clicked
public void optionsTopMenuPrefrenceButton(MouseEvent mouseEvent) throws IOException {
wOpener.newWindow("/resources/fxml/preference.fxml", "Prefrences", StageStyle.UNDECORATED,800, 400);
optionsmenu.setVisible(false); //Deactivates option slider
FXMLLoader loader = new FXMLLoader(getClass().getResource("/resources/fxml/preference.fxml"));
Parent root = loader.load();
preferenceController prfcont = loader.getController();
prfcont.setPreferenceLabels(pref0.get("username", "Entre a username"), pref0.get("name", "Entre a name"));
wOpener.newWindowExitingScene(root, "Prefrences", StageStyle.UNDECORATED,800, 400);
optionsmenu.setVisible(false);
}

@ -23,6 +23,13 @@ public class preferenceController {
@FXML private TextField nameInputField;
public void setPreferenceLabels(String username, String name) {
this.usernameInputField.setText(username);
this.nameInputField.setText(name);
}
//Const
double x,y;
Preferences pref0 = Preferences.userRoot().node("genealogieresearchtool/Test"); //Gets the user preferences

@ -90,4 +90,36 @@ public class windowOpener {
}
}
/**
* This function can be used for opening a new Window with an exiting scene.
* @param scene Parent of scene
* @param title String of the title.
* @param width Int for width.
* @param height Int for height.
* @author <a href="http://lukasmartin.eu">Lukas Martin</a>
* @version 1.1
* @since 11
*/
public void newWindowExitingScene(Parent scene, String title, StageStyle stageStyle, Integer width, Integer height) {
Stage secStage = new Stage();
if(height == 1080 && width == 1920) {
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
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 {
secStage.setScene(new Scene(scene, width, height));
secStage.setTitle(title);
secStage.centerOnScreen();
secStage.initStyle(stageStyle);
}
secStage.show();
}
}

@ -64,4 +64,14 @@
-fx-background-color: #252530;
-fx-border-color: #6b6868;
-fx-border-width: 0.5px 0.5px 0.5px 0px;
}
}
#welcomeLabel {
}
#searchBar {
-fx-background-color: #252530;
-fx-border-color: #6b6868;
-fx-border-width: 0.5px 0.5px 0.5px 0.5px;
-fx-text-fill: white;
-fx-border-radius: 8 8 8 8;
-fx-background-radius: 8 8 8 8;
}

@ -4,37 +4,29 @@
.background {
-fx-background-color: #252530;
}
.topbar {
-fx-background-color: #0b111a;
}
.menu {
-fx-border-color: #6b6868;
-fx-border-width: 0px 0px 0.5px 0px;
}
#lefttopbar {
}
#righttopbar {
}
#leftPane {
-fx-border-color: #6b6868;
-fx-border-width: 0.5px 0.5px 0.5px 0.5px;
}
#centrePane {
}
#submitButton {
}
#nicknameLabel {
-fx-border-color: #6b6868;
-fx-border-width: 0px 0px 0.5px 0px;
@ -56,4 +48,6 @@
}
#menu1MainPane {
}
#welcomeText {
}

@ -36,13 +36,13 @@
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon?>
<?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?>
<?import javafx.scene.text.Text?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" onKeyPressed="#pressedkey" prefHeight="680.0" prefWidth="1280.0" xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.homeController">
<BorderPane id="borderpane" layoutX="162.0" layoutY="64.0" prefHeight="200.0" prefWidth="200.0" stylesheets="@../css/home.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
@ -115,19 +115,35 @@
<center>
<AnchorPane onMouseClicked="#bodyOnClick" onMouseEntered="#bodyMouseEntred" prefHeight="627.0" prefWidth="1135.0" BorderPane.alignment="CENTER">
<Pane id="panehome" stylesheets="@../css/home.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<Text fill="WHITE" layoutX="492.0" layoutY="316.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Dashboard und so, lol.">
<font>
<Font size="30.0" />
</font>
</Text>
<VBox id="menuslide" fx:id="menuslideV" prefHeight="622.0" prefWidth="200.0" stylesheets="@../css/home.css" visible="false">
<Label fx:id="usernameMenuLabel" prefHeight="20.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" />
<JFXListCell id="buttonStammbaum" fx:id="buttonStammbaum" onMouseClicked="#buttonStammbaumClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Stammbaum" textFill="WHITE" />
<JFXListCell id="buttonPeople" fx:id="buttonPeople" onMouseClicked="#buttonPeopleClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="People" textFill="WHITE" />
<JFXListCell id="buttonPictrues" fx:id="buttonPictures" onMouseClicked="#buttonPicturesClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Pictures" textFill="WHITE" />
<JFXListCell id="buttonResearch" fx:id="buttoResearch" onMouseClicked="#buttonResearchClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Research " textFill="WHITE" />
<JFXListCell id="buttonMoney" fx:id="buttonMoney" onMouseClicked="#buttonMoneyClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Money" textFill="WHITE" />
<JFXListCell id="buttonOptions" fx:id="buttonOptions" onMouseClicked="#buttonOptionsClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Optionen" textFill="WHITE" />
<VBox id="menuslide" fx:id="menuslideV" prefHeight="622.0" prefWidth="200.0" stylesheets="@../css/home.css">
<Pane prefHeight="34.0" prefWidth="198.0" styleClass="background" stylesheets="@../css/prefrence.css">
<padding>
<Insets left="10.0" />
</padding>
<Label id="labelSearch" fx:id="labelSearch" contentDisplay="CENTER" layoutX="74.0" layoutY="14.0" prefHeight="25.0" prefWidth="50.0" stylesheets="@../css/home.css" text="Search" textAlignment="CENTER" textFill="#71f86e">
<font>
<Font size="16.0" />
</font>
</Label>
</Pane>
<Pane prefHeight="52.0" prefWidth="198.0" stylesheets="@../css/home.css">
<TextField id="searchBar" layoutX="7.0" layoutY="11.0" prefHeight="31.0" prefWidth="185.0" styleClass="background" stylesheets="@../css/home.css" />
</Pane>
<Pane prefHeight="35.0" prefWidth="198.0">
<Label id="labelWindows" fx:id="labelWindows" contentDisplay="CENTER" layoutX="65.0" layoutY="9.0" prefHeight="23.0" prefWidth="68.0" stylesheets="@../css/home.css" text="Windows" textAlignment="CENTER" textFill="#71f86e">
<font>
<Font size="16.0" />
</font>
</Label>
</Pane>
<JFXListCell id="buttonStammbaum" fx:id="buttonStammbaum" alignment="CENTER" onMouseClicked="#buttonStammbaumClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Stammbaum" textFill="WHITE" />
<JFXListCell id="buttonResearch" fx:id="buttoResearch" alignment="CENTER" onMouseClicked="#buttonResearchClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Research " textFill="WHITE" />
<JFXListCell id="buttonPeople" fx:id="buttonPeople" alignment="CENTER" contentDisplay="CENTER" onMouseClicked="#buttonPeopleClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="People " textFill="WHITE" />
<JFXListCell id="buttonPictrues" fx:id="buttonPictures" alignment="CENTER" onMouseClicked="#buttonPicturesClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Pictures " textFill="WHITE" />
<JFXListCell id="buttonMoney" fx:id="buttonMoney" alignment="CENTER" contentDisplay="CENTER" onMouseClicked="#buttonMoneyClicked" prefHeight="40.0" prefWidth="198.0" styleClass="buttonMenu" stylesheets="@../css/home.css" text="Money " textFill="WHITE" />
<opaqueInsets>
<Insets />
</opaqueInsets>
</VBox>
<VBox id="filesmenu" fx:id="filesmenu" layoutX="57.0" onMouseExited="#filesOpenPaneExited" prefHeight="250.0" prefWidth="150.0" stylesheets="@../css/home.css" visible="false" />
<BorderPane id="optionPane" fx:id="optionsmenu" layoutX="91.0" onMouseEntered="#optionPaneEntered" onMouseExited="#optionPaneExited" prefHeight="245.0" prefWidth="148.0" visible="false">
@ -138,7 +154,7 @@
</center>
<bottom>
<VBox id="VboxOption1" prefHeight="30.0" prefWidth="147.0" stylesheets="@../css/home.css" BorderPane.alignment="CENTER">
<JFXListCell id="prefreceButtonOptionsMenu" onMouseClicked="#optionsTopMenuPrefrenceButton" prefHeight="33.0" prefWidth="184.0" styleClass="buttonTopBarMenus" stylesheets="@../css/home.css" text="Prefrences" />
<JFXListCell id="prefreceButtonOptionsMenu" fx:id="preferenceButton" onMouseClicked="#optionsTopMenuPrefrenceButton" prefHeight="33.0" prefWidth="184.0" styleClass="buttonTopBarMenus" stylesheets="@../css/home.css" text="Prefrences" />
</VBox>
</bottom>
</BorderPane>

Loading…
Cancel
Save