Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

JavaFX2.0 instance of own group

865128May 28 2011 — edited May 28 2011
Hi, could anyone tell m where my failure is? I'm playing with the examples from JavaFX...

Heres the GameGroup:
public class GameGroup extends Group{
    
    GameGroup()
    {
        Group circles = new Group();
        for (int i = 0; i < 30; i++) {
            Circle circle = new Circle(150, Color.web("white", 0.05));
            circle.setStrokeType(StrokeType.OUTSIDE);
            circle.setStroke(Color.web("white", 0.16));
            circle.setStrokeWidth(4);
            circles.getChildren().add(circle);
        }
        circles.setEffect(new BoxBlur(10, 10, 3));
    }
}
And this is the part of the Main Class:
    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("QQQ");
        Group root = new Group();
        Scene scene = new Scene(root, 800, 600, Color.BLUE);
        GameGroup gameGroup = new GameGroup();
        gameGroup.setTranslateX(50);
        gameGroup.setTranslateY(50);
        root.getChildren().add(gameGroup);        
        primaryStage.setScene(scene);
        primaryStage.setVisible(true);
    }
All I do see is a blue screen...

Edited by: 862125 on 28.05.2011 04:44

Comments

shakir.gusaroff
I am not 100% sure. But you can try this:
import javafx.scene.*;
import javafx.scene.shape.*;
import javafx.scene.paint.*;
import javafx.scene.effect.BoxBlur;
public class GameGroup  extends Group{
    
    GameGroup()
    {
        //Group circles = new Group();
        for (int i = 0; i < 30; i++) {
            Circle circle = new Circle(150, Color.web("white", 0.05));
            circle.setStrokeType(StrokeType.OUTSIDE);
            circle.setStroke(Color.web("white", 0.16));
            circle.setStrokeWidth(4);
           // circles.getChildren().add(circle);
            getChildren().add(circle);
        }
        
       // circles.setEffect(new BoxBlur(10, 10, 3));
        setEffect(new BoxBlur(10, 10, 3));
    }
}
865128
Thank you Shakir, that's it.
1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 25 2011
Added on May 28 2011
2 comments
63 views