×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Richard McDonald
Added: Aug 22, 2015 3:40 AM
Views: 16
Tags: javafx
Uses a Timeline to animate the opening and closing of a Pane.
  1.     private void showPane(boolean show) {
  2.         int height;
  3.         if (show) {
  4.             height = 200;
  5.         } else {
  6.             height = 0;
  7.         }
  8.         Timeline timeline = new Timeline();
  9.         timeline.getKeyFrames().add(new KeyFrame(Duration.millis(300),
  10.                 new KeyValue(pane.prefHeightProperty(), height),
  11.                 new KeyValue(pane.minHeightProperty(), height),
  12.                 new KeyValue(pane.maxHeightProperty(), height)
  13.         ));
  14.         timeline.play();
  15.     }
  16.