changeset 6964:225ce268fe32

[TOYS] Updated HelloAccordion and HelloTitledPane to cover cases in RT-36868
author Martin Sladecek <martin.sladecek@oracle.com>
date Fri, 02 May 2014 08:38:54 +0200
parents 077a84d87eb4
children 6bc3a6e9b4b8
files apps/toys/Hello/src/main/java/hello/HelloAccordion.java apps/toys/Hello/src/main/java/hello/HelloTitledPane.java
diffstat 2 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/apps/toys/Hello/src/main/java/hello/HelloAccordion.java	Fri May 02 08:05:38 2014 +0200
+++ b/apps/toys/Hello/src/main/java/hello/HelloAccordion.java	Fri May 02 08:38:54 2014 +0200
@@ -32,15 +32,13 @@
 import javafx.scene.control.Button;
 import javafx.scene.control.Label;
 import javafx.scene.control.TitledPane;
+import javafx.scene.layout.VBox;
 import javafx.scene.paint.Color;
 import javafx.stage.Stage;
 
 public class HelloAccordion extends Application {
 
     @Override public void start(Stage stage) {
-        stage.setTitle("Accordion Sample");
-        Scene scene = new Scene(new Group(), 500, 500);
-        scene.setFill(Color.GHOSTWHITE);
 
         TitledPane t1 = new TitledPane();
         t1.setId("Label 1");
@@ -63,11 +61,15 @@
         accordion.getPanes().add(t2);
         accordion.getPanes().add(t3);
 
-        Group root = (Group)scene.getRoot();
-        root.setTranslateX(50);
-        root.setTranslateY(50);
-        root.getChildren().clear();
+        stage.setTitle("Accordion Sample");
+
+        final VBox root = new VBox(20);
+        root.setFillWidth(false);
+        Scene scene = new Scene(root, 500, 500);
         root.getChildren().add(accordion);
+
+        root.getChildren().add(new Button("This button doesn't change it's layout when Accordion is used"));
+
         stage.setScene(scene);
         stage.show();
     }
--- a/apps/toys/Hello/src/main/java/hello/HelloTitledPane.java	Fri May 02 08:05:38 2014 +0200
+++ b/apps/toys/Hello/src/main/java/hello/HelloTitledPane.java	Fri May 02 08:38:54 2014 +0200
@@ -36,6 +36,7 @@
 import javafx.scene.layout.GridPane;
 import javafx.scene.layout.HBox;
 import javafx.scene.layout.StackPane;
+import javafx.scene.layout.VBox;
 import javafx.scene.paint.Color;
 import javafx.scene.text.Font;
 import javafx.stage.Stage;
@@ -48,9 +49,7 @@
 
     @Override public void start(Stage stage) {
         stage.setTitle("TitledPane");
-        Scene scene = new Scene(new Group(), 1000, 250);
-        scene.setFill(Color.GHOSTWHITE);
-        
+
         // --- Simple grid test
         TitledPane gridTitlePane = new TitledPane();
         GridPane grid = new GridPane();
@@ -64,14 +63,14 @@
         grid.add(new TextField(), 1, 2);
         gridTitlePane.setText("Hello World!");
         gridTitlePane.setContent(grid);
-        
+
         // --- Label test
         TitledPane normalText = new TitledPane();
         Label lbl = new Label("This is a collapsible TitledPane\nthat allows for text to be wrapped.\n\nIt should be the perfect height to fit all text provided.\n\nIs it?");
         normalText.setText("Hello World!");
         normalText.setFont(Font.font(20));
         normalText.setContent(lbl);
-        
+
         // --- Big button test
         TitledPane normal = new TitledPane();
         Button bn = new Button("Button");
@@ -95,13 +94,13 @@
         Button bf = new Button("Button");
         bf.setPrefSize(75, 50);
         uncollapsible.setContent(bf);
-        
-        HBox hbox = new HBox(10);
+
+        VBox hbox = new VBox(10);
         hbox.setPadding(new Insets(20, 0, 0, 20));
         hbox.getChildren().setAll(normal, gridTitlePane, normalText, unanimated, uncollapsible);
 
-        Group root = (Group)scene.getRoot();
-        root.getChildren().add(hbox);
+        Scene scene = new Scene(hbox);
+        scene.setFill(Color.GHOSTWHITE);
         stage.setScene(scene);
         stage.show();
     }