Berbagai contoh Layout pada JavaFX 1.3


Ini berbagai contoh layout pada JavaFX 1.3

package bab8_antarmuka;

import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.layout.Flow;
import javafx.scene.layout.Panel;
import javafx.scene.layout.Stack;
import javafx.scene.layout.ClipView;
import javafx.scene.layout.Tile;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.ScrollView;
import javafx.scene.layout.LayoutInfo;
import javafx.geometry.Insets;
import javafx.scene.shape.Circle;
import javafx.scene.paint.Color;
import javafx.scene.Node;
import javafx.scene.shape.Polygon;
import javafx.scene.shape.Ellipse;
import javafx.scene.shape.CubicCurve;

/**
* @author bhangun
*/
function shapes(i: Integer): Node {
var seq = [
Circle {
radius: 30  fill:Color.BLUE
},
CubicCurve {
startX: 0 startY: 50
controlX1: 25 controlY1: 0
controlX2: 75 controlY2: 100
endX: 100 endY: 50
fill:Color.RED
},
Ellipse {
radiusX: 40, radiusY: 15
fill:Color.YELLOW
},
Rectangle {width: 40 height: 40
fill:Color.BLACK},
Polygon {
points: [0, 0, 100, 0, 100, 40]
fill:Color.GREEN
}
];
seq[i]
}

var hBox = HBox {
padding: Insets {top: 10 right: 4 bottom: 4 left: 10 }
spacing: 10
content: for (i in [0..4])
shapes(i)
}
var vBox = VBox {
padding: Insets {top: 10 right: 4 bottom: 4 left: 10 }
spacing: 10
content: for (i in [0..4])
shapes(i)
}
var flow = Flow {
wrapLength: 100 // preferred width is 100
hgap: 5 vgap: 10
content: for (i in [0..4])
shapes(i)
}
var panel = Panel {
content: for (i in [0..4])
shapes(i)
}
var stack = Stack {
content: for (i in [0..4])
shapes(i)
}
var clipView = ClipView {
}
var tile = Tile {
content: for (i in [0..4])
shapes(i)
}

Stage {

title: “Layout”
scene: Scene {
width: 500
height: 500
content: [
ScrollView {
layoutInfo: LayoutInfo {
width: 500
height: 500
}
node: HBox {
padding: Insets {top: 10 right: 4 bottom: 4 left: 5 }
spacing: 10
content: [
hBox,
vBox,
flow,
panel,
stack,
//clipView,
tile,

]
}
}
]
}
}

Advertisements

One Response to Berbagai contoh Layout pada JavaFX 1.3

  1. […] Berbagai contoh Layout pada JavaFX 1.3 June 2010 4 […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: