package javafx_rect;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.RectangleBuilder;
import javafx.stage.Stage;
/**
*
* @web http://java-buddy.blogspot.com/
*/
public class JavaFX_Rect extends Application {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("java-buddy.blogspot.com");
Rectangle rect1 = new Rectangle(10, 10, 280, 130);
rect1.setFill(Color.BLUE);
rect1.setStrokeWidth(3);
rect1.setStroke(Color.BLACK);
Rectangle rect2 = RectangleBuilder.create()
.arcWidth(30)
.arcHeight(30)
.fill(Color.WHITESMOKE)
.x(10)
.y(160)
.strokeWidth(3)
.stroke(Color.BLACK)
.build();
rect2.setWidth(280);
rect2.setHeight(130);
Group root = new Group();
root.getChildren().addAll(rect1, rect2);
primaryStage.setScene(new Scene(root, 300, 300));
primaryStage.show();
}
}
Thursday, March 15, 2012
JavaFX 2.0: Rectangle and RectangleBuilder
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment