package testjfxjava; import com.sun.javafx.functions.Function0; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.collections.Sequence; import javafx.lang.Duration; import javafx.lang.FX; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.Line; import javafx.scene.shape.LineTo; import javafx.scene.shape.MoveTo; import javafx.scene.shape.Path; import javafx.stage.Stage; import java.util.Random; /** * User: Artem * Date: Sep 9, 2010 * Time: 6:29:43 PM */ public class Test2 { private final static int W = 1024; private final static int H = 768; private final static int N = 480; private final static Random r = new Random(); private static Path path; private static void runTest2() { Stage stage = new Stage(); stage.setWidth(W); stage.setHeight(H); stage.setX(100); stage.setY(100); stage.setTitle("Test2"); stage.setScene(createScene()); // stage.setVisible(true); } private final static int region = 100; private final static int diff = 15; private static Scene createScene() { Scene scene = new Scene(); Line l = new Line(0, 100 * H / N, W, 100 * H / N); l.setStroke(Color.rgb(0x66, 0x66, 0x66)); l.setStrokeWidth(1); scene.getContent().add(l); path = new Path(); path.setStroke(Color.BLACK); path.setStrokeWidth(2); path.getElements().add(new MoveTo(0, region)); for (int i = 0; i < N; i++) { int x = i; int y = region + r.nextInt() % diff; path.getElements().add(new LineTo(x * W / N, y * H / N)); } scene.getContent().add(path); return scene; } public static void main(String[] args) { FX.start(new Runnable() { @Override public void run() { runTest2(); } }); } }