fix javafx theme

This commit is contained in:
SeekDaSky 2017-12-19 17:31:27 +01:00
parent 9b7840f277
commit b0fdff38ab
2 changed files with 57 additions and 61 deletions

View File

@ -49,6 +49,8 @@ public class RootLayout extends Application implements EventObserver {
/* (1) store primary stage + title it */
this.root_stage = primary_stage;
this.root_stage.setTitle("Language learner pro plus 2000");
setUserAgentStylesheet(STYLESHEET_CASPIAN);
/* (2) Load the root layout*/
this.loadRootLayout();
@ -254,15 +256,25 @@ public class RootLayout extends Application implements EventObserver {
}
public void handleMainLayoutChange(String layout) {
FlowPane container = (FlowPane) this.root_layout.lookup("#container");
container.getChildren().clear();
this.main_container.getChildren().clear();
switch(layout) {
case "dictionary" :
container.getChildren().add(new Text("dictionary"));
this.main_container.getChildren().add(new Text("dictionary"));
break;
case "exercises" :
container.getChildren().add(new Text("exercises"));
/* (1) Load the root_disp.fxml */
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/fxml/vocabulary_disp.fxml"));
/* (2) Load the layout into the scene */
try {
this.main_container.getChildren().add((AnchorPane) loader.load());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
case "translator" :
this.root_layout.lookup("#submenu").setVisible(false);

View File

@ -1,70 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.Cursor?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<AnchorPane id="vocab" fx:id="card1" prefHeight="228.0" prefWidth="620.0" style="-fx-border-insets: 10; -fx-background-insets: 10; -fx-background-color: #ffffff; -fx-background-radius: 3; -fx-border-radius: 3; -fx-border-color: #ddd;">
<AnchorPane id="vocab" fx:id="vocab" prefHeight="228.0" prefWidth="620.0" style="-fx-border-insets: 10; -fx-background-insets: 10; -fx-background-color: #ffffff; -fx-background-radius: 3; -fx-border-radius: 3; -fx-border-color: #ddd;" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1">
<opaqueInsets>
<Insets />
</opaqueInsets>
<children>
<FlowPane columnHalignment="CENTER" layoutX="51.0" layoutY="54.0" prefHeight="149.0" prefWidth="160.0" vgap="10.0">
<children>
<TextField promptText="manger" />
<TextField layoutX="10.0" layoutY="10.0" promptText="voyager" />
<TextField layoutX="10.0" layoutY="36.0" promptText="dormir" />
<TextField layoutX="10.0" layoutY="62.0" promptText="apprendre" />
</children>
</FlowPane>
<FlowPane columnHalignment="CENTER" layoutX="251.0" layoutY="56.0" prefHeight="151.0" prefWidth="160.0" vgap="10.0">
<children>
<TextField promptText="pain (du)" />
<TextField promptText="nourriture (la)" />
<TextField promptText="animaux (des)" />
</children>
</FlowPane>
<FlowPane columnHalignment="CENTER" layoutX="438.0" layoutY="53.0" prefHeight="139.0" prefWidth="160.0" vgap="10.0">
<children>
<TextField promptText="journal (un)" />
<TextField promptText="pays (un)" />
<TextField promptText="chambre (une)" />
</children>
</FlowPane>
<Text layoutX="249.0" layoutY="48.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 20;" text="Vocabulary #1" />
<Text layoutX="35.0" layoutY="83.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="1" />
<Text layoutX="33.0" layoutY="118.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="4" />
<Text layoutX="33.0" layoutY="151.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="7" />
<Text layoutX="24.0" layoutY="185.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="10" />
<Text layoutX="234.0" layoutY="83.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="2" />
<Text layoutX="232.0" layoutY="118.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="5" />
<Text layoutX="232.0" layoutY="151.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="8" />
<Text layoutX="423.0" layoutY="80.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="3" />
<Text layoutX="421.0" layoutY="115.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="6" />
<Text layoutX="421.0" layoutY="148.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="9" />
<Button id="voc_btn" fx:id="voc_btn" layoutX="536.0" layoutY="194.0" mnemonicParsing="false" style="-fx-background-color: #ffffff; -fx-border-width: 1; -fx-border-color: #aaaaaa; -fx-text-fill: #000000; -fx-border-radius: 3; -fx-background-radius: 3;" text="Check" />
<FlowPane columnHalignment="CENTER" layoutX="51.0" layoutY="54.0" prefHeight="149.0" prefWidth="160.0" vgap="10.0">
<children>
<TextField promptText="manger" />
<TextField layoutX="10.0" layoutY="10.0" promptText="voyager" />
<TextField layoutX="10.0" layoutY="36.0" promptText="dormir" />
<TextField layoutX="10.0" layoutY="62.0" promptText="apprendre" />
</children>
</FlowPane>
<FlowPane columnHalignment="CENTER" layoutX="251.0" layoutY="56.0" prefHeight="151.0" prefWidth="160.0" vgap="10.0">
<children>
<TextField promptText="pain (du)" />
<TextField promptText="nourriture (la)" />
<TextField promptText="animaux (des)" />
</children>
</FlowPane>
<FlowPane columnHalignment="CENTER" layoutX="438.0" layoutY="53.0" prefHeight="139.0" prefWidth="160.0" vgap="10.0">
<children>
<TextField promptText="journal (un)" />
<TextField promptText="pays (un)" />
<TextField promptText="chambre (une)" />
</children>
</FlowPane>
<Text layoutX="249.0" layoutY="48.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 20;" text="Vocabulary #1" />
<Text layoutX="35.0" layoutY="83.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="1" />
<Text layoutX="33.0" layoutY="118.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="4" />
<Text layoutX="33.0" layoutY="151.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="7" />
<Text layoutX="24.0" layoutY="185.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="10" />
<Text layoutX="234.0" layoutY="83.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="2" />
<Text layoutX="232.0" layoutY="118.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="5" />
<Text layoutX="232.0" layoutY="151.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="8" />
<Text layoutX="423.0" layoutY="80.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="3" />
<Text layoutX="421.0" layoutY="115.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="6" />
<Text layoutX="421.0" layoutY="148.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="9" />
<Button layoutX="536.0" layoutY="194.0" mnemonicParsing="false" style="-fx-background-color: #ffffff; -fx-border-width: 1; -fx-border-color: #aaaaaa; -fx-text-fill: #000000; -fx-border-radius: 3; -fx-background-radius: 3;" text="Check" />
</children>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</AnchorPane>