This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Accessing objects withing a Scene's content sequence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Accessing objects withing a Scene Watch "Accessing objects withing a Scene New topic
Author

Accessing objects withing a Scene's content sequence

Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 814
    
    3
Hello Jim, Jim, and Eric,

I've got an idea for a JavaFX utility, but it depends on being able to look at the contents of a Scene's content property. Is there a way to walk the object graph and get a reference to the various objects contained there? I hope I worded that correctly.

Thanks,
Burk


SCJP, SCJD, SCEA 5 "Any sufficiently analyzed magic is indistinguishable from science!" Agatha Heterodyne (Girl Genius)
Jim Clarke
author
Ranch Hand

Joined: Jun 15, 2009
Posts: 49
How about:



The order of the content is also the zorder for display. The first item in the content sequence is painted behind the next item, etc.
The last item is always on top. The Node.toFront() and toBack() actually move the node in the content sequence order.
You can remove a component:

or add
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 814
    
    3
Jim Clarke wrote:

OK, if I understand you then the key is line 1 because of the declaration of the var 'scene' which allows you to access the contents of the Scene object. But I'm wondering about accessing the Stage's scene property without an external variable because that's the way the code is generated in NetBeans, and I suspect it's either the standard way of writing JavaFX, or it will be the soon.

So, if you have code like this:
Is there a way to get a reference to the properties of the Text object? It seems to me that there's some code generation or inheritance going on behind the scenes (pardon the pun) because every JavaFX class that doesn't explicitly extend another class extends Object - just like it does in Java. That coupled with the fact that we create a run() method instead of a main() method makes me think that the above script gets rolled into a class of some kind; in which case the Stage instance could be being assigned to some property of that class - which means I might be able to access it. Whew!

Does that make any sense?

Burk
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing objects withing a Scene's content sequence
 
Similar Threads
GC
Removing graphical trash from JLayeredPane
Question related to Garbage Collector
How to set unique boundary string in MimeMultipart?
do I need to synchronize or not?