This commit is contained in:
SeekDaSky 2017-12-20 16:52:04 +01:00
commit 4879f204b6
6 changed files with 153 additions and 64 deletions

View File

@ -39,6 +39,7 @@ public class RootLayout extends Application implements EventObserver {
private Scene root_scene;
private AnchorPane root_layout;
private FlowPane main_container;
private VBox main_menu;
private Article articles;
private Traduction dico;
@ -153,8 +154,8 @@ public class RootLayout extends Application implements EventObserver {
this.root_stage.setScene(this.root_scene);
//bind events on click fot the menu
VBox menuRoot = (VBox) this.root_layout.lookup("#menu");
for (Node c : menuRoot.getChildren()) {
this.main_menu = (VBox) this.root_layout.lookup("#menu");
for (Node c : this.main_menu.getChildren()) {
c.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
@ -257,24 +258,45 @@ public class RootLayout extends Application implements EventObserver {
public void handleMainLayoutChange(String layout) {
this.main_container.getChildren().clear();
FXMLLoader loader;
/* Un-select all menu items but re-select the chosen one */
for( Node n : this.main_menu.getChildren() ){
n.getStyleClass().clear();
n.getStyleClass().add("menu_item");
if( n.getId() == layout )
n.getStyleClass().add("active");
}
switch(layout) {
case "dictionary" :
this.main_container.getChildren().add(new Text("dictionary"));
break;
case "exercises" :
/* (1) Load the root_disp.fxml */
FXMLLoader loader = new 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();
}
try {
this.main_container.getChildren().add((AnchorPane) loader.load());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
case "exercises" :
/* (1) Load the root_disp.fxml */
loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/fxml/exercise_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

@ -13,4 +13,14 @@
-fx-pref-height: 26;
-fx-pref-width: 759;
-fx-margin: 20 0 20 0;
}
#vocab > * > *{
-fx-background-color: #ffffff;
-fx-border-width: 0 0 1 0;
-fx-border-color: #dddddd;
}
#vocab{
-fx-cursor: normal;
}

View File

@ -36,6 +36,10 @@
-fx-border-color: #eeeeee;
}
.menu_item.active{
-fx-background-color: #eeeeee;
}
#menu{
-fx-background-color: #ffffff;

53
fxml/exercise_disp.fxml Normal file
View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.Cursor?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Text?>
<AnchorPane id="exerc" fx:id="exerc" 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>
<Text layoutX="251.0" layoutY="39.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 20;" text="Exercise #1" />
<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" />
<Text layoutX="47.0" layoutY="96.0" strokeType="OUTSIDE" strokeWidth="0.0" text="&quot;I am doing my homework&quot; is affirmative" />
<Text layoutX="47.0" layoutY="118.0" strokeType="OUTSIDE" strokeWidth="0.0" />
<Text layoutX="105.0" layoutY="129.0" strokeType="OUTSIDE" strokeWidth="0.0" text="&quot;Where do you live ?&quot; is passive" />
<Text layoutX="33.0" layoutY="161.0" strokeType="OUTSIDE" strokeWidth="0.0" text="&quot;She had a nightmare&quot; happens in the past" />
<Text layoutX="59.0" layoutY="191.0" strokeType="OUTSIDE" strokeWidth="0.0" text="&quot;She had a dream ?&quot; is a valid question" />
<Text layoutX="317.0" layoutY="67.0" strokeType="OUTSIDE" strokeWidth="0.0" text="True" />
<Text layoutX="352.0" layoutY="68.0" strokeType="OUTSIDE" strokeWidth="0.0" text="False" />
<RadioButton layoutX="327.0" layoutY="83.0" mnemonicParsing="false" selected="true">
<toggleGroup>
<ToggleGroup fx:id="g1" />
</toggleGroup>
</RadioButton>
<RadioButton layoutX="353.0" layoutY="83.0" mnemonicParsing="false" toggleGroup="$g1" />
<RadioButton layoutX="327.0" layoutY="117.0" mnemonicParsing="false" selected="true">
<toggleGroup>
<ToggleGroup fx:id="g2" />
</toggleGroup>
</RadioButton>
<RadioButton layoutX="353.0" layoutY="117.0" mnemonicParsing="false" toggleGroup="$g2" />
<RadioButton layoutX="327.0" layoutY="148.0" mnemonicParsing="false" selected="true">
<toggleGroup>
<ToggleGroup fx:id="g3" />
</toggleGroup>
</RadioButton>
<RadioButton layoutX="353.0" layoutY="148.0" mnemonicParsing="false" toggleGroup="$g3" />
<RadioButton layoutX="327.0" layoutY="178.0" mnemonicParsing="false" selected="true">
<toggleGroup>
<ToggleGroup fx:id="g4" />
</toggleGroup>
</RadioButton>
<RadioButton layoutX="353.0" layoutY="178.0" mnemonicParsing="false" toggleGroup="$g4" />
</children>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</AnchorPane>

View File

@ -342,16 +342,16 @@
</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" />
<Text layoutX="37.0" layoutY="74.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="1" />
<Text layoutX="35.0" layoutY="109.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="4" />
<Text layoutX="35.0" layoutY="145.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="7" />
<Text layoutX="26.0" layoutY="181.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="10" />
<Text layoutX="238.0" layoutY="74.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="2" />
<Text layoutX="236.0" layoutY="111.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="5" />
<Text layoutX="236.0" layoutY="147.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="8" />
<Text layoutX="427.0" layoutY="72.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="3" />
<Text layoutX="425.0" layoutY="109.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="6" />
<Text layoutX="425.0" layoutY="144.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>

View File

@ -8,47 +8,47 @@
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.text.Text?>
<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">
<AnchorPane id="vocab" fx:id="vocab" prefHeight="228.0" prefWidth="620.0" style="-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 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>
<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="34.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 20;" text="Vocabulary #1" />
<Text layoutX="37.0" layoutY="74.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="1" />
<Text layoutX="35.0" layoutY="109.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="4" />
<Text layoutX="35.0" layoutY="145.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="7" />
<Text layoutX="26.0" layoutY="181.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="10" />
<Text layoutX="238.0" layoutY="74.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="2" />
<Text layoutX="236.0" layoutY="111.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="5" />
<Text layoutX="236.0" layoutY="147.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="8" />
<Text layoutX="427.0" layoutY="72.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="3" />
<Text layoutX="425.0" layoutY="109.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="6" />
<Text layoutX="425.0" layoutY="144.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>
</AnchorPane>