Application Basis

  • Beitrags-Autor:
  • Beitrags-Kategorie:JavaFX
Group root = new Group();
Scene scene = new Scene(root, 600, 480, Color.BLACK);
 
Rectangle rect = new Rectangle(10, 10, 50, 50);
rect.setFill(Color.TRANSPARENT);
rect.setStroke(Color.RED);
rect.setStrokeWidth(1);
root.getChildren().addAll(rect);
 
primaryStage.setTitle("ZeigeLayout");
primaryStage.setScene(scene);
primaryStage.show();
Canvas canvas = new Canvas(600, 480);
GraphicsContext gc;
gc = canvas.getGraphicsContext2D();
gc.setLineWidth(1);
 
Rectangle rect = new Rectangle(10, 10, 50, 50);
gc.strokeRect(rect.x, rect.y, rect.width, rect.height);
 
BorderPane pane = new BorderPane();
pane.setCenter(canvas);
 
Scene scene = new Scene(pane);
primaryStage.setTitle("MaleLayout");
primaryStage.setScene(scene);
primaryStage.show();

siehe auch: https://gist.github.com/abdelaziz321