It's not a secret anymore!
The moose likes JavaFX and the fly likes JavaFX Using Multiple Stages with Netbeans JavaFX Designer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JavaFX
Bookmark "JavaFX Using Multiple Stages with Netbeans JavaFX Designer" Watch "JavaFX Using Multiple Stages with Netbeans JavaFX Designer" New topic

JavaFX Using Multiple Stages with Netbeans JavaFX Designer

Stephen Davies
Ranch Hand

Joined: Jul 23, 2008
Posts: 352
I'm at my wits end. I am developing an in-house application in JavaFx using Netbeans 6.9 and its Fx Designer tooling. All is well with the UI design, however, I have come across a problem. In Netbeans, I create two fx files (essentially two classes with their own stages, scenes and States etc) through the use of the design and source views in Netbeans fx Designer. The classes are named 'Login' and 'Homepage' respectively. In the Main.fx file which I selected to be auto-created when the fx project is created in Netbeans, I set the run functions design variable to point to the Login class, which then gets its design file accordingly. When I run all is well I can see my Login Class OK and the window is shown.

I have created a Login button and form that receives user credentials on this login view which will check the credentials entered against a database, but for now the login button function is intended just to open the Homepage view, and herein lies my issue. How on Earth do I do this?? I am not using scenes, I have a Hompage.fx file which has its own class and Stage, but in Netbeans the default Stage and class cannot be altered (in this case the one in the Login Class). I have tried many different approaches, offered by Good and awful examples stemming from a Google Search.

Pragmatically I need to create functionality in the login function which creates a new instance of the Homepage Class and then runs the stage in that class, closing the login stage (or at least removing it from memory). The issue seems to be exacerbated by the auto generated code of Netbeans, which is a double edged blade for me as I need the drag and drop designer to save copious development time(IM the only developer on this project) but on the other hand it seems in this case, to be obfuscating my ability to customize the code I need.

I would love to print out all the code here for a better context but there is much auto generated nonsense which would confuse things, however I will try to give a pseudo outline.

be a well encapsulated person, don't expose your privates, unless you public void getWife()!
Rob Spoor

Joined: Oct 27, 2005
Posts: 20273

Please try to keep your lines a bit shorter. I've split the long comment over two lines so there's no longer a need for horizontal scrolling.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: JavaFX Using Multiple Stages with Netbeans JavaFX Designer
It's not a secret anymore!