# HG changeset patch
# User e095732
# Date 1359422968 -32400
# Node ID 4823e45e8a2c36384d7e8d6b1a3aef36313b0e8d
# Parent b973de8b678572cc790d53f38dc423d383b1e8c2
add sample
diff -r b973de8b6785 -r 4823e45e8a2c src/alice/test/topology/aquarium/fx/aquarium.fxml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/alice/test/topology/aquarium/fx/aquarium.fxml Tue Jan 29 10:29:28 2013 +0900
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r b973de8b6785 -r 4823e45e8a2c src/example/CubeSample.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/example/CubeSample.java Tue Jan 29 10:29:28 2013 +0900
@@ -0,0 +1,155 @@
+package example;
+
+/**
+ * Copyright (c) 2008, 2012 Oracle and/or its affiliates.
+ * All rights reserved. Use is subject to license terms.
+ */
+import javafx.scene.transform.Rotate;
+import javafx.scene.PerspectiveCamera;
+import javafx.scene.transform.Translate;
+import javafx.application.Application;
+import javafx.scene.Group;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+import javafx.animation.Animation;
+import javafx.animation.KeyFrame;
+import javafx.animation.KeyValue;
+import javafx.animation.Timeline;
+import javafx.scene.Node;
+import javafx.scene.paint.Color;
+import javafx.scene.shape.RectangleBuilder;
+import javafx.util.Duration;
+
+/**
+ * A sample that demonstrates an animated rotation of 3D cubes. When the
+ * application runs in standalone mode, the scene must be constructed with
+ * the depthBuffer argument set to true, and the root node must have depthTest
+ * set to true.
+ *
+ * @see javafx.scene.transform.Rotate
+ * @see javafx.scene.paint.Color
+ * @see javafx.scene.shape.RectangleBuilder
+ */
+public class CubeSample extends Application {
+
+ private Timeline animation;
+
+ private void init(Stage primaryStage) {
+ Group root = new Group();
+ primaryStage.setResizable(false);
+ primaryStage.setScene(new Scene(root, 400,150,true));
+ primaryStage.getScene().setCamera(new PerspectiveCamera());
+ root.getTransforms().addAll(
+ new Translate(400 / 2, 150 / 2),
+ new Rotate(180, Rotate.X_AXIS)
+ );
+ root.getChildren().add(create3dContent());
+ }
+
+ public Node create3dContent() {
+ Cube c = new Cube(50,Color.RED,1);
+ c.rx.setAngle(45);
+ c.ry.setAngle(45);
+ Cube c2 = new Cube(50,Color.GREEN,1);
+ c2.setTranslateX(100);
+ c2.rx.setAngle(45);
+ c2.ry.setAngle(45);
+ Cube c3 = new Cube(50,Color.ORANGE,1);
+ c3.setTranslateX(-100);
+ c3.rx.setAngle(45);
+ c3.ry.setAngle(45);
+
+ animation = new Timeline();
+ animation.getKeyFrames().addAll(
+ new KeyFrame(Duration.ZERO,
+ new KeyValue(c.ry.angleProperty(), 0d),
+ new KeyValue(c2.rx.angleProperty(), 0d),
+ new KeyValue(c3.rz.angleProperty(), 0d)
+ ),
+ new KeyFrame(Duration.seconds(1),
+ new KeyValue(c.ry.angleProperty(), 360d),
+ new KeyValue(c2.rx.angleProperty(), 360d),
+ new KeyValue(c3.rz.angleProperty(), 360d)
+ ));
+ animation.setCycleCount(Animation.INDEFINITE);
+
+ return new Group(c,c2,c3);
+ }
+
+ public void play() {
+ animation.play();
+ }
+
+ @Override public void stop() {
+ animation.pause();
+ }
+
+ public class Cube extends Group {
+ final Rotate rx = new Rotate(0,Rotate.X_AXIS);
+ final Rotate ry = new Rotate(0,Rotate.Y_AXIS);
+ final Rotate rz = new Rotate(0,Rotate.Z_AXIS);
+ public Cube(double size, Color color, double shade) {
+ getTransforms().addAll(rz, ry, rx);
+ getChildren().addAll(
+ RectangleBuilder.create() // back face
+ .width(size).height(size)
+ .fill(color.deriveColor(0.0, 1.0, (1 - 0.5*shade), 1.0))
+ .translateX(-0.5*size)
+ .translateY(-0.5*size)
+ .translateZ(0.5*size)
+ .build(),
+ RectangleBuilder.create() // bottom face
+ .width(size).height(size)
+ .fill(color.deriveColor(0.0, 1.0, (1 - 0.4*shade), 1.0))
+ .translateX(-0.5*size)
+ .translateY(0)
+ .rotationAxis(Rotate.X_AXIS)
+ .rotate(90)
+ .build(),
+ RectangleBuilder.create() // right face
+ .width(size).height(size)
+ .fill(color.deriveColor(0.0, 1.0, (1 - 0.3*shade), 1.0))
+ .translateX(-1*size)
+ .translateY(-0.5*size)
+ .rotationAxis(Rotate.Y_AXIS)
+ .rotate(90)
+ .build(),
+ RectangleBuilder.create() // left face
+ .width(size).height(size)
+ .fill(color.deriveColor(0.0, 1.0, (1 - 0.2*shade), 1.0))
+ .translateX(0)
+ .translateY(-0.5*size)
+ .rotationAxis(Rotate.Y_AXIS)
+ .rotate(90)
+ .build(),
+ RectangleBuilder.create() // top face
+ .width(size).height(size)
+ .fill(color.deriveColor(0.0, 1.0, (1 - 0.1*shade), 1.0))
+ .translateX(-0.5*size)
+ .translateY(-1*size)
+ .rotationAxis(Rotate.X_AXIS)
+ .rotate(90)
+ .build(),
+ RectangleBuilder.create() // top face
+ .width(size).height(size)
+ .fill(color)
+ .translateX(-0.5*size)
+ .translateY(-0.5*size)
+ .translateZ(-0.5*size)
+ .build()
+ );
+ }
+ }
+
+
+ public double getSampleWidth() { return 400; }
+
+ public double getSampleHeight() { return 150; }
+
+ @Override public void start(Stage primaryStage) throws Exception {
+ init(primaryStage);
+ primaryStage.show();
+ play();
+ }
+ public static void main(String[] args) { launch(args); }
+}
diff -r b973de8b6785 -r 4823e45e8a2c src/example/Hello.fxml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/example/Hello.fxml Tue Jan 29 10:29:28 2013 +0900
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r b973de8b6785 -r 4823e45e8a2c src/example/HelloFXML.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/example/HelloFXML.java Tue Jan 29 10:29:28 2013 +0900
@@ -0,0 +1,27 @@
+package example;
+
+import java.io.File;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+public class HelloFXML extends Application {
+
+ @Override
+ public void start(Stage stage) throws Exception {
+ Parent root = FXMLLoader.load(getClass().getResource("Hello.fxml"));
+
+ Scene scene = new Scene(root);
+
+ stage.setScene(scene);
+ stage.show();
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new File(".").getAbsolutePath());
+ launch(args);
+ }
+}
diff -r b973de8b6785 -r 4823e45e8a2c src/example/HelloWorld.class
Binary file src/example/HelloWorld.class has changed
diff -r b973de8b6785 -r 4823e45e8a2c src/example/HelloWorld.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/example/HelloWorld.java Tue Jan 29 10:29:28 2013 +0900
@@ -0,0 +1,25 @@
+package example;
+
+import javafx.application.Application;
+import javafx.scene.Scene;
+import javafx.scene.control.Label;
+import javafx.scene.layout.BorderPane;
+import javafx.stage.Stage;
+
+public class HelloWorld extends Application {
+
+ @Override
+ public void start(Stage primaryStage) {
+ BorderPane borderPane = new BorderPane();
+ borderPane.setCenter( new Label( "Hello JavaFX!" ) );
+
+ Scene scene = new Scene( borderPane, 200, 150 );
+ primaryStage.setScene( scene );
+
+ primaryStage.show();
+ }
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff -r b973de8b6785 -r 4823e45e8a2c src/example/LoginDemo.fxml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/example/LoginDemo.fxml Tue Jan 29 10:29:28 2013 +0900
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r b973de8b6785 -r 4823e45e8a2c src/example/LoginDemo.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/example/LoginDemo.java Tue Jan 29 10:29:28 2013 +0900
@@ -0,0 +1,90 @@
+package example;
+
+import javafx.application.Application;
+import javafx.geometry.Pos;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.control.PasswordField;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
+
+public class LoginDemo extends Application {
+ @Override
+ public void start(Stage stage) {
+ stage.setTitle("Login Demo");
+
+ AnchorPane root = new AnchorPane();
+ Scene scene = new Scene(root);
+ stage.setScene(scene);
+
+ root.setMinSize(100.0, 138.0);
+ root.setPrefSize(320.0, 138.0);
+
+ VBox vbox = new VBox();
+ root.getChildren().add(vbox);
+
+ AnchorPane.setTopAnchor(vbox, 14.0);
+ AnchorPane.setBottomAnchor(vbox, 14.0);
+ AnchorPane.setLeftAnchor(vbox, 14.0);
+ AnchorPane.setRightAnchor(vbox, 14.0);
+
+ AnchorPane topPane = new AnchorPane();
+ vbox.getChildren().add(topPane);
+ topPane.setPrefHeight(40.0);
+
+ Label accountLabel = new Label("Account");
+ topPane.getChildren().add(accountLabel);
+
+ accountLabel.setPrefWidth(80.0);
+ AnchorPane.setTopAnchor(accountLabel, 0.0);
+ AnchorPane.setLeftAnchor(accountLabel, 0.0);
+
+ TextField accountField = new TextField();
+ topPane.getChildren().add(accountField);
+
+ accountField.setPrefWidth(160.0);
+ AnchorPane.setTopAnchor(accountField, 0.0);
+ AnchorPane.setLeftAnchor(accountField, 80.0);
+ AnchorPane.setRightAnchor(accountField, 0.0);
+
+ AnchorPane middlePane = new AnchorPane();
+ vbox.getChildren().add(middlePane);
+ middlePane.setPrefHeight(40.0);
+
+ Label passwordLabel = new Label("Password");
+ middlePane.getChildren().add(passwordLabel);
+
+ passwordLabel.setPrefWidth(80.0);
+ AnchorPane.setTopAnchor(passwordLabel, 0.0);
+ AnchorPane.setLeftAnchor(passwordLabel, 0.0);
+
+ PasswordField passwordField = new PasswordField();
+ middlePane.getChildren().add(passwordField);
+
+ passwordField.setPrefWidth(160.0);
+ AnchorPane.setTopAnchor(passwordField, 0.0);
+ AnchorPane.setLeftAnchor(passwordField, 80.0);
+ AnchorPane.setRightAnchor(passwordField, 0.0);
+
+ HBox bottomPane = new HBox(14.0);
+ vbox.getChildren().add(bottomPane);
+
+ bottomPane.setPrefHeight(30.0);
+ bottomPane.setAlignment(Pos.TOP_RIGHT);
+
+ Button loginButton = new Button("Login");
+ bottomPane.getChildren().add(loginButton);
+ Button cancelButton = new Button("Cancel");
+ bottomPane.getChildren().add(cancelButton);
+
+ stage.show();
+ }
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
\ No newline at end of file
diff -r b973de8b6785 -r 4823e45e8a2c src/example/LoginDemo2.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/example/LoginDemo2.java Tue Jan 29 10:29:28 2013 +0900
@@ -0,0 +1,26 @@
+package example;
+
+import java.io.IOException;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Scene;
+import javafx.scene.layout.AnchorPane;
+import javafx.stage.Stage;
+
+
+public class LoginDemo2 extends Application {
+
+ @Override
+ public void start(Stage primaryStage) throws IOException {
+ AnchorPane root = FXMLLoader.load(getClass().getResource("LoginDemo.fxml"));
+ Scene scene = new Scene(root);
+
+ primaryStage.setScene(scene);
+ primaryStage.show();
+ }
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff -r b973de8b6785 -r 4823e45e8a2c src/example/LoginFormController.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/example/LoginFormController.java Tue Jan 29 10:29:28 2013 +0900
@@ -0,0 +1,33 @@
+package example;
+
+import java.net.URL;
+import java.util.ResourceBundle;
+
+
+import javafx.event.ActionEvent;
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.scene.control.PasswordField;
+import javafx.scene.control.TextField;
+
+public class LoginFormController implements Initializable {
+ @FXML
+ private TextField accountField;
+
+ @FXML
+ private PasswordField passwordField;
+
+ @FXML
+ public void handleLogin(ActionEvent event) {
+
+ }
+
+ @FXML
+ public void handleCancel(ActionEvent event) {
+
+ }
+ @Override
+ public void initialize(URL url, ResourceBundle rb) {
+ accountField.setText("dummy");
+ }
+}