Class Group

  • Stage and Scene. The central idea of having Stage and Scene in designers of the API
    begins with a notion, where a theater or a play (container) in which actors (controls) perform in front of an audience.
    • In a Stage will have a scene will appear like an orchestrated base where actors or controls will cite or perform their roles/acts to play.
  • In this analogy, in JavaFX the Stage is equivalent to an application window similar to Java Swing API JFrame or JDialog on the desktop.
    • A Scene object as a content pane, similar
      to Java Swing’s JPanel, capable of holding zero-to-many Node objects (children).
  • The example below has a simple group (a No-Resizable container) ; unlike Group, with Pane you may use a preset function like "setPrefSize(200,200);" .

Code ::

package javafxtemplate1;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
//import javafx.scene.layout.Pane;
//import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;

 * @author Manas14

public class JavaFXTemplate1 extends Application {
    public void start(Stage primaryStage) {
        //comparing Group with Pane :: doc 1
        //Group is Not-Resizable to Sizable setPrefSize
    Group canvas = new Group(); 
       // Pane canvas = new Pane();
     canvas.setStyle("-fx-background-color: white;");
     Label label1 = new Label("Scence is Title Free"); 
     Circle circle = new Circle(50,Color.BLUE);
     circle.relocate(20, 20);
     Rectangle rectangle = new Rectangle(100,100,Color.RED);
     label1.relocate(100, 10);// x = 100, y height = 10
     canvas.getChildren().addAll(circle,rectangle, label1);
     Scene scene = new Scene(canvas,300,200);
     // scene.setTitle("Group or Pane:: canvas");
     // Above is not allowed
    primaryStage.setTitle("Stage Group :: Controls");;

    public static void main(String[] args) {

Runtime View ::