< prev index next >

apps/toys/Hello/src/main/java/hello/HelloCSS.java

Print this page




 155                 r2.getChildren().add(swapButton);
 156             } else if (swapButton.getParent() == r2) {
 157                 r2.getChildren().remove(swapButton);
 158                 r1.getChildren().add(swapButton);
 159             }
 160         });
 161         r1.getChildren().add(swapButton);
 162 
 163         FlowPane hBox = new FlowPane(Orientation.HORIZONTAL, 5, 5);
 164         hBox.getChildren().addAll(r1, r2, new Text("Click button to move.\nButton's base color should match surrounding border."));
 165 
 166         return hBox;
 167     }
 168 
 169     private static class TestNode extends Rectangle {
 170 
 171         public TestNode() {
 172             super(100, 100);
 173         }
 174 
 175         @Override public void impl_processCSS() {
 176             super.impl_processCSS();
 177         }
 178         StyleablePropertyFactory<TestNode> factory = new StyleablePropertyFactory<>(Rectangle.getClassCssMetaData());
 179         StyleableProperty<Duration> myDuration = factory.createStyleableDurationProperty(this, "myDuration", "-my-duration", (s) -> s.myDuration, Duration.millis(1000));
 180 
 181         @Override public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
 182             return factory.getCssMetaData();
 183         }
 184     }
 185 
 186 
 187     BooleanProperty fadeIn = new SimpleBooleanProperty(false);
 188     private Node createDurationTest() {
 189 
 190         final BorderPane pane = new BorderPane();
 191         pane.setStyle("-fx-border-color: blue;");
 192         pane.setPadding(new Insets(10,10,10,10));
 193 
 194         Slider slider = new Slider();
 195         slider.setPadding(new Insets(5,5,5,10));
 196         slider.setMin(500d);
 197         slider.setMax(1500d);




 155                 r2.getChildren().add(swapButton);
 156             } else if (swapButton.getParent() == r2) {
 157                 r2.getChildren().remove(swapButton);
 158                 r1.getChildren().add(swapButton);
 159             }
 160         });
 161         r1.getChildren().add(swapButton);
 162 
 163         FlowPane hBox = new FlowPane(Orientation.HORIZONTAL, 5, 5);
 164         hBox.getChildren().addAll(r1, r2, new Text("Click button to move.\nButton's base color should match surrounding border."));
 165 
 166         return hBox;
 167     }
 168 
 169     private static class TestNode extends Rectangle {
 170 
 171         public TestNode() {
 172             super(100, 100);
 173         }
 174 



 175         StyleablePropertyFactory<TestNode> factory = new StyleablePropertyFactory<>(Rectangle.getClassCssMetaData());
 176         StyleableProperty<Duration> myDuration = factory.createStyleableDurationProperty(this, "myDuration", "-my-duration", (s) -> s.myDuration, Duration.millis(1000));
 177 
 178         @Override public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
 179             return factory.getCssMetaData();
 180         }
 181     }
 182 
 183 
 184     BooleanProperty fadeIn = new SimpleBooleanProperty(false);
 185     private Node createDurationTest() {
 186 
 187         final BorderPane pane = new BorderPane();
 188         pane.setStyle("-fx-border-color: blue;");
 189         pane.setPadding(new Insets(10,10,10,10));
 190 
 191         Slider slider = new Slider();
 192         slider.setPadding(new Insets(5,5,5,10));
 193         slider.setMin(500d);
 194         slider.setMax(1500d);


< prev index next >