This commit is contained in:
SeekDaSky 2017-12-19 17:06:22 +01:00
commit 640dd5d8a7
3 changed files with 128 additions and 50 deletions

View File

@ -2,7 +2,12 @@ package Classes.css.user;
import Classes.css.core.Context; import Classes.css.core.Context;
import Classes.css.core.Ruleset; import Classes.css.core.Ruleset;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Bounds;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.FlowPane;
public class ContainerScrollStyleSheet{ public class ContainerScrollStyleSheet{
@ -16,6 +21,22 @@ public class ContainerScrollStyleSheet{
.add("right", 0) .add("right", 0)
// .add("pref-height", ) // .add("pref-height", )
.apply(); .apply();
/* (2) Manage dynamic 1st children bounds to it */
ScrollPane spane = (ScrollPane) target;
spane.layoutBoundsProperty().addListener(new ChangeListener(){
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
System.out.println(spane.getLayoutBounds().getWidth());
FlowPane child = (FlowPane) spane.getContent();
child.setPrefWidth( spane.getLayoutBounds().getWidth() );
child.setPrefHeight( spane.getLayoutBounds().getHeight() );
}
});
} }
} }

View File

@ -2,13 +2,13 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.Cursor?> <?import javafx.scene.Cursor?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ScrollPane?> <?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?> <?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.FlowPane?> <?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?> <?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
@ -312,60 +312,47 @@
</children></VBox> </children></VBox>
<ScrollPane id="scroll_container" fx:id="scroll_container" hbarPolicy="NEVER" pickOnBounds="false" prefHeight="651.0" prefWidth="1015.0" style="-fx-background-color: transparent;" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="49.0"> <ScrollPane id="scroll_container" fx:id="scroll_container" hbarPolicy="NEVER" pickOnBounds="false" prefHeight="651.0" prefWidth="1015.0" style="-fx-background-color: transparent;" AnchorPane.bottomAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="49.0">
<content> <content>
<FlowPane id="container" fx:id="container" alignment="TOP_CENTER" columnHalignment="CENTER" prefHeight="650.0" prefWidth="1000.0" prefWrapLength="1000.0" stylesheets="@../css/container.css"> <FlowPane id="container" fx:id="container" alignment="TOP_CENTER" columnHalignment="CENTER" prefHeight="650.0" prefWrapLength="1000.0" stylesheets="@../css/container.css">
<children> <children>
<TextField id="mag_searchbar" fx:id="mag_searchbar" prefHeight="26.0" prefWidth="759.0" promptText="Search..."> <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;">
<FlowPane.margin>
<Insets bottom="20.0" top="20.0" />
</FlowPane.margin>
</TextField>
<AnchorPane fx:id="card1" style="-fx-border-insets: 10; -fx-background-insets: 10; -fx-background-color: #fff; -fx-background-radius: 3; -fx-border-radius: 3; -fx-border-color: #ddd;">
<opaqueInsets> <opaqueInsets>
<Insets /> <Insets />
</opaqueInsets> </opaqueInsets>
<children> <children>
<ImageView fitHeight="56.0" fitWidth="56.0" layoutX="-28.0" layoutY="38.0" pickOnBounds="true" preserveRatio="true" AnchorPane.bottomAnchor="20.0" AnchorPane.leftAnchor="20.0" AnchorPane.topAnchor="20.0"> <FlowPane columnHalignment="CENTER" layoutX="51.0" layoutY="54.0" prefHeight="149.0" prefWidth="160.0" vgap="10.0">
<image> <children>
<Image url="@../src/menu_profile_1.png" /> <TextField promptText="manger" />
</image> <TextField layoutX="10.0" layoutY="10.0" promptText="voyager" />
</ImageView> <TextField layoutX="10.0" layoutY="36.0" promptText="dormir" />
<Text fill="#808080" fontSmoothingType="LCD" layoutX="118.0" layoutY="78.8439998626709" strokeType="OUTSIDE" strokeWidth="0.0" text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam posuere odio ut sem vestibulum, at tempus neque luctus. Curabitur quis tortor bibendum" wrappingWidth="653.0" AnchorPane.leftAnchor="96.0" AnchorPane.topAnchor="50.0"> <TextField layoutX="10.0" layoutY="62.0" promptText="apprendre" />
<font> </children>
<Font name="Lato Regular" size="12.0" /> </FlowPane>
</font> <FlowPane columnHalignment="CENTER" layoutX="251.0" layoutY="56.0" prefHeight="151.0" prefWidth="160.0" vgap="10.0">
</Text> <children>
<Text fill="#757575" layoutX="611.0" layoutY="37.0" strokeType="OUTSIDE" strokeWidth="0.0" text="10 days ago" textAlignment="RIGHT" AnchorPane.rightAnchor="20.0" AnchorPane.topAnchor="20.0"> <TextField promptText="pain (du)" />
<font> <TextField promptText="nourriture (la)" />
<Font name="Lato Bold" size="12.0" /> <TextField promptText="animaux (des)" />
</font> </children>
</Text> </FlowPane>
<HBox layoutX="118.0" layoutY="39.0" prefHeight="21.0" prefWidth="200.0" AnchorPane.leftAnchor="96.0" AnchorPane.topAnchor="20.0"> <FlowPane columnHalignment="CENTER" layoutX="438.0" layoutY="53.0" prefHeight="139.0" prefWidth="160.0" vgap="10.0">
<children> <children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Some Article Title"> <TextField promptText="journal (un)" />
<font> <TextField promptText="pays (un)" />
<Font name="Lato Bold" size="17.0" /> <TextField promptText="chambre (une)" />
</font> </children>
</Text> </FlowPane>
<FlowPane alignment="CENTER" columnHalignment="CENTER" prefHeight="20.0" style="-fx-background-color: red; -fx-background-radius: 3;"> <Text layoutX="249.0" layoutY="48.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 20;" text="Vocabulary #1" />
<children> <Text layoutX="35.0" layoutY="83.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="1" />
<Text fill="WHITE" fontSmoothingType="LCD" strokeType="OUTSIDE" strokeWidth="0.0" text="nature"> <Text layoutX="33.0" layoutY="118.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="4" />
<font> <Text layoutX="33.0" layoutY="151.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="7" />
<Font name="Lato Regular" size="14.0" /> <Text layoutX="24.0" layoutY="185.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="10" />
</font> <Text layoutX="234.0" layoutY="83.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="2" />
<FlowPane.margin> <Text layoutX="232.0" layoutY="118.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="5" />
<Insets /> <Text layoutX="232.0" layoutY="151.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="8" />
</FlowPane.margin> <Text layoutX="423.0" layoutY="80.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="3" />
</Text> <Text layoutX="421.0" layoutY="115.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="6" />
</children> <Text layoutX="421.0" layoutY="148.0" strokeType="OUTSIDE" strokeWidth="0.0" style="-fx-font-size: 16;" text="9" />
<HBox.margin> <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" />
<Insets left="10.0" />
</HBox.margin>
<padding>
<Insets left="5.0" right="5.0" />
</padding>
</FlowPane>
</children>
</HBox>
</children> </children>
<cursor> <cursor>
<Cursor fx:constant="HAND" /> <Cursor fx:constant="HAND" />

70
fxml/vocabulary_disp.fxml Normal file
View File

@ -0,0 +1,70 @@
<?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?>
<?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;">
<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" />
</children>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</AnchorPane>