< prev index next >

functional/SceneGraphTests/src/test/scenegraph/app/TimelineApp.java

Print this page




  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  */
  24 package test.scenegraph.app;
  25 
  26 //import java.awt.Event;
  27 import javafx.animation.KeyFrame;
  28 import javafx.animation.Timeline;
  29 import javafx.event.ActionEvent;
  30 import javafx.event.Event;
  31 import javafx.event.EventHandler;
  32 import javafx.scene.Node;
  33 import javafx.scene.control.Button;
  34 import javafx.scene.control.ButtonBuilder;
  35 import javafx.scene.control.Label;
  36 import javafx.scene.layout.HBox;
  37 import javafx.scene.layout.Pane;
  38 import javafx.scene.layout.StackPane;
  39 import javafx.scene.layout.TilePane;
  40 import javafx.scene.layout.VBox;
  41 import javafx.scene.paint.Color;
  42 import javafx.scene.paint.Paint;
  43 import javafx.scene.shape.Rectangle;
  44 import javafx.scene.text.Font;
  45 import javafx.scene.text.FontWeight;
  46 import javafx.scene.text.Text;
  47 import javafx.util.Duration;
  48 import test.javaclient.shared.BasicButtonChooserApp;
  49 import test.javaclient.shared.TestNode;
  50 
  51 /**
  52  *
  53  * @author Sergey Grinev
  54  */


 126                     timeline.setCycleCount(1);
 127 
 128                     addSlot("plain", field);
 129                 }
 130                 //autoreverse
 131                 {
 132                     final Pane field = new HBox(5);
 133                     Timeline timeline = createTimelineAndPlayButton(field, "2");
 134                     timeline.setAutoReverse(true);
 135                     timeline.setCycleCount(2);
 136 
 137                     addSlot("autoreverse", field);
 138                 }
 139                 //infinite + stop
 140                 {
 141                     final TilePane field = new TilePane(5, 5);
 142                     field.setPrefColumns(2);
 143                     final Timeline timeline = createTimelineAndPlayButton(field, "3");
 144                     timeline.setAutoReverse(false);
 145                     timeline.setCycleCount(Timeline.INDEFINITE);
 146                     field.getChildren().add(ButtonBuilder.create().text("stop").onAction(new EventHandler<ActionEvent>() {

 147                         public void handle(ActionEvent t) {
 148                             timeline.stop();
 149                         }
 150                     }).build());

 151 
 152                     addSlot("infinite-stop", field);
 153                 }
 154                 //infinite + pause
 155                 {
 156                     final TilePane field = new TilePane(5, 5);
 157                     field.setPrefColumns(2);
 158                     final Timeline timeline = createTimelineAndPlayButton(field, "4");
 159                     timeline.setAutoReverse(false);
 160                     timeline.setCycleCount(Timeline.INDEFINITE);
 161                     field.getChildren().add(ButtonBuilder.create().text("pause").onAction(new EventHandler<ActionEvent>() {

 162                         public void handle(ActionEvent t) {
 163                             timeline.pause();
 164                         }
 165                     }).build());

 166 
 167                     addSlot("infinite-pause", field);
 168                 }
 169                 return root;
 170 
 171             }
 172         };
 173         root.add(page,"Timeline");
 174         this.selectNode(page);
 175         return root;
 176     }
 177 }


  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  */
  24 package test.scenegraph.app;
  25 
  26 //import java.awt.Event;
  27 import javafx.animation.KeyFrame;
  28 import javafx.animation.Timeline;
  29 import javafx.event.ActionEvent;
  30 import javafx.event.Event;
  31 import javafx.event.EventHandler;
  32 import javafx.scene.Node;
  33 import javafx.scene.control.Button;

  34 import javafx.scene.control.Label;
  35 import javafx.scene.layout.HBox;
  36 import javafx.scene.layout.Pane;
  37 import javafx.scene.layout.StackPane;
  38 import javafx.scene.layout.TilePane;
  39 import javafx.scene.layout.VBox;
  40 import javafx.scene.paint.Color;
  41 import javafx.scene.paint.Paint;
  42 import javafx.scene.shape.Rectangle;
  43 import javafx.scene.text.Font;
  44 import javafx.scene.text.FontWeight;
  45 import javafx.scene.text.Text;
  46 import javafx.util.Duration;
  47 import test.javaclient.shared.BasicButtonChooserApp;
  48 import test.javaclient.shared.TestNode;
  49 
  50 /**
  51  *
  52  * @author Sergey Grinev
  53  */


 125                     timeline.setCycleCount(1);
 126 
 127                     addSlot("plain", field);
 128                 }
 129                 //autoreverse
 130                 {
 131                     final Pane field = new HBox(5);
 132                     Timeline timeline = createTimelineAndPlayButton(field, "2");
 133                     timeline.setAutoReverse(true);
 134                     timeline.setCycleCount(2);
 135 
 136                     addSlot("autoreverse", field);
 137                 }
 138                 //infinite + stop
 139                 {
 140                     final TilePane field = new TilePane(5, 5);
 141                     field.setPrefColumns(2);
 142                     final Timeline timeline = createTimelineAndPlayButton(field, "3");
 143                     timeline.setAutoReverse(false);
 144                     timeline.setCycleCount(Timeline.INDEFINITE);
 145                     Button temp1 = new Button("stop");
 146                     temp1.setOnAction(new EventHandler<ActionEvent>() {
 147                         public void handle(ActionEvent t) {
 148                             timeline.stop();
 149                         }
 150                     });
 151                     field.getChildren().add(temp1);
 152 
 153                     addSlot("infinite-stop", field);
 154                 }
 155                 //infinite + pause
 156                 {
 157                     final TilePane field = new TilePane(5, 5);
 158                     field.setPrefColumns(2);
 159                     final Timeline timeline = createTimelineAndPlayButton(field, "4");
 160                     timeline.setAutoReverse(false);
 161                     timeline.setCycleCount(Timeline.INDEFINITE);
 162                     Button temp2 = new Button("pause");
 163                     temp2.setOnAction(new EventHandler<ActionEvent>() {
 164                         public void handle(ActionEvent t) {
 165                             timeline.pause();
 166                         }
 167                     });
 168                     field.getChildren().add(temp2);
 169 
 170                     addSlot("infinite-pause", field);
 171                 }
 172                 return root;
 173 
 174             }
 175         };
 176         root.add(page,"Timeline");
 177         this.selectNode(page);
 178         return root;
 179     }
 180 }
< prev index next >