Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Build a JavaFX Application Graphical User Interfaces Getting Started

Paramvir Singh
Paramvir Singh
1,517 Points

What does "Group" do and what is it used for?

As far as I know, "Group wasn't mentioned in the previous videos and I got confused when it was introduced in this video (where he showed us how to make a simple program which writes "sup"). Can some please explain it to me?

2 Answers

Basically, its to create an object class. If you have gone through Java Basics, it was taught how to make an object.

Group is an object and named as root to create a new Group.

Group root = new Group();

I'm not entirely sure but i think Group is basically the white background of a web page or a scene as her refers to in previous videos. You need this in order to add things like text, buttons, graphs, etc onto your page. Just like he made the text sup and used group to add it onto the screen.

If its still confusing you can do the same thing in Java instead of using javaFX except you use JFrame. If you look up JFrame and watch a video its all easier to understand in my opinion but the concepts are the same.