Merge branch 'master' of https://git.xdrm.io/MTI/javafx-p1
This commit is contained in:
commit
4879f204b6
|
@ -39,6 +39,7 @@ public class RootLayout extends Application implements EventObserver {
|
||||||
private Scene root_scene;
|
private Scene root_scene;
|
||||||
private AnchorPane root_layout;
|
private AnchorPane root_layout;
|
||||||
private FlowPane main_container;
|
private FlowPane main_container;
|
||||||
|
private VBox main_menu;
|
||||||
private Article articles;
|
private Article articles;
|
||||||
private Traduction dico;
|
private Traduction dico;
|
||||||
|
|
||||||
|
@ -153,8 +154,8 @@ public class RootLayout extends Application implements EventObserver {
|
||||||
this.root_stage.setScene(this.root_scene);
|
this.root_stage.setScene(this.root_scene);
|
||||||
|
|
||||||
//bind events on click fot the menu
|
//bind events on click fot the menu
|
||||||
VBox menuRoot = (VBox) this.root_layout.lookup("#menu");
|
this.main_menu = (VBox) this.root_layout.lookup("#menu");
|
||||||
for (Node c : menuRoot.getChildren()) {
|
for (Node c : this.main_menu.getChildren()) {
|
||||||
c.setOnMousePressed(new EventHandler<MouseEvent>() {
|
c.setOnMousePressed(new EventHandler<MouseEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(MouseEvent event) {
|
public void handle(MouseEvent event) {
|
||||||
|
@ -257,24 +258,45 @@ public class RootLayout extends Application implements EventObserver {
|
||||||
|
|
||||||
public void handleMainLayoutChange(String layout) {
|
public void handleMainLayoutChange(String layout) {
|
||||||
this.main_container.getChildren().clear();
|
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) {
|
switch(layout) {
|
||||||
case "dictionary" :
|
case "dictionary" :
|
||||||
this.main_container.getChildren().add(new Text("dictionary"));
|
|
||||||
break;
|
|
||||||
case "exercises" :
|
|
||||||
/* (1) Load the root_disp.fxml */
|
/* (1) Load the root_disp.fxml */
|
||||||
FXMLLoader loader = new FXMLLoader();
|
loader = new FXMLLoader();
|
||||||
|
|
||||||
loader.setLocation(getClass().getResource("/fxml/vocabulary_disp.fxml"));
|
loader.setLocation(getClass().getResource("/fxml/vocabulary_disp.fxml"));
|
||||||
|
|
||||||
/* (2) Load the layout into the scene */
|
/* (2) Load the layout into the scene */
|
||||||
try {
|
try {
|
||||||
this.main_container.getChildren().add((AnchorPane) loader.load());
|
this.main_container.getChildren().add((AnchorPane) loader.load());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
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;
|
break;
|
||||||
case "translator" :
|
case "translator" :
|
||||||
this.root_layout.lookup("#submenu").setVisible(false);
|
this.root_layout.lookup("#submenu").setVisible(false);
|
||||||
|
|
|
@ -13,4 +13,14 @@
|
||||||
-fx-pref-height: 26;
|
-fx-pref-height: 26;
|
||||||
-fx-pref-width: 759;
|
-fx-pref-width: 759;
|
||||||
-fx-margin: 20 0 20 0;
|
-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;
|
||||||
}
|
}
|
|
@ -36,6 +36,10 @@
|
||||||
-fx-border-color: #eeeeee;
|
-fx-border-color: #eeeeee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.menu_item.active{
|
||||||
|
-fx-background-color: #eeeeee;
|
||||||
|
}
|
||||||
|
|
||||||
#menu{
|
#menu{
|
||||||
-fx-background-color: #ffffff;
|
-fx-background-color: #ffffff;
|
||||||
|
|
||||||
|
|
|
@ -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=""I am doing my homework" 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=""Where do you live ?" is passive" />
|
||||||
|
<Text layoutX="33.0" layoutY="161.0" strokeType="OUTSIDE" strokeWidth="0.0" text=""She had a nightmare" happens in the past" />
|
||||||
|
<Text layoutX="59.0" layoutY="191.0" strokeType="OUTSIDE" strokeWidth="0.0" text=""She had a dream ?" 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>
|
|
@ -342,16 +342,16 @@
|
||||||
</children>
|
</children>
|
||||||
</FlowPane>
|
</FlowPane>
|
||||||
<Text layoutX="249.0" layoutY="48.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 20;" text="Vocabulary #1" />
|
<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="37.0" layoutY="74.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="35.0" layoutY="109.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="35.0" layoutY="145.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="26.0" layoutY="181.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="238.0" layoutY="74.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="236.0" layoutY="111.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="236.0" layoutY="147.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="427.0" layoutY="72.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="425.0" layoutY="109.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="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" />
|
<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>
|
</children>
|
||||||
<cursor>
|
<cursor>
|
||||||
|
|
|
@ -8,47 +8,47 @@
|
||||||
<?import javafx.scene.layout.FlowPane?>
|
<?import javafx.scene.layout.FlowPane?>
|
||||||
<?import javafx.scene.text.Text?>
|
<?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>
|
<opaqueInsets>
|
||||||
<Insets />
|
<Insets />
|
||||||
</opaqueInsets>
|
</opaqueInsets>
|
||||||
<children>
|
<children>
|
||||||
<FlowPane columnHalignment="CENTER" layoutX="51.0" layoutY="54.0" prefHeight="149.0" prefWidth="160.0" vgap="10.0">
|
<FlowPane columnHalignment="CENTER" layoutX="51.0" layoutY="54.0" prefHeight="149.0" prefWidth="160.0" vgap="10.0">
|
||||||
<children>
|
<children>
|
||||||
<TextField promptText="manger" />
|
<TextField promptText="manger" />
|
||||||
<TextField layoutX="10.0" layoutY="10.0" promptText="voyager" />
|
<TextField layoutX="10.0" layoutY="10.0" promptText="voyager" />
|
||||||
<TextField layoutX="10.0" layoutY="36.0" promptText="dormir" />
|
<TextField layoutX="10.0" layoutY="36.0" promptText="dormir" />
|
||||||
<TextField layoutX="10.0" layoutY="62.0" promptText="apprendre" />
|
<TextField layoutX="10.0" layoutY="62.0" promptText="apprendre" />
|
||||||
</children>
|
</children>
|
||||||
</FlowPane>
|
</FlowPane>
|
||||||
<FlowPane columnHalignment="CENTER" layoutX="251.0" layoutY="56.0" prefHeight="151.0" prefWidth="160.0" vgap="10.0">
|
<FlowPane columnHalignment="CENTER" layoutX="251.0" layoutY="56.0" prefHeight="151.0" prefWidth="160.0" vgap="10.0">
|
||||||
<children>
|
<children>
|
||||||
<TextField promptText="pain (du)" />
|
<TextField promptText="pain (du)" />
|
||||||
<TextField promptText="nourriture (la)" />
|
<TextField promptText="nourriture (la)" />
|
||||||
<TextField promptText="animaux (des)" />
|
<TextField promptText="animaux (des)" />
|
||||||
</children>
|
</children>
|
||||||
</FlowPane>
|
</FlowPane>
|
||||||
<FlowPane columnHalignment="CENTER" layoutX="438.0" layoutY="53.0" prefHeight="139.0" prefWidth="160.0" vgap="10.0">
|
<FlowPane columnHalignment="CENTER" layoutX="438.0" layoutY="53.0" prefHeight="139.0" prefWidth="160.0" vgap="10.0">
|
||||||
<children>
|
<children>
|
||||||
<TextField promptText="journal (un)" />
|
<TextField promptText="journal (un)" />
|
||||||
<TextField promptText="pays (un)" />
|
<TextField promptText="pays (un)" />
|
||||||
<TextField promptText="chambre (une)" />
|
<TextField promptText="chambre (une)" />
|
||||||
</children>
|
</children>
|
||||||
</FlowPane>
|
</FlowPane>
|
||||||
<Text layoutX="249.0" layoutY="48.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 20;" text="Vocabulary #1" />
|
<Text layoutX="249.0" layoutY="34.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="37.0" layoutY="74.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="35.0" layoutY="109.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="35.0" layoutY="145.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="26.0" layoutY="181.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="238.0" layoutY="74.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="236.0" layoutY="111.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="236.0" layoutY="147.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="427.0" layoutY="72.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="425.0" layoutY="109.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="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" />
|
<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>
|
</children>
|
||||||
<cursor>
|
<cursor>
|
||||||
<Cursor fx:constant="HAND" />
|
<Cursor fx:constant="HAND" />
|
||||||
</cursor>
|
</cursor>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
|
Loading…
Reference in New Issue