Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Correct Way???

 
Jim Schneider
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am a java newbie but not to programming and trying to learn and put a desktop application together. I would like to know is there a right/wrong ways to open/start a Java desktop application.
My thoughts are as follows:
Have an "application manager object" that basically handles the entire
application. This object would be created in the main function of the
class.
This object would then handle everything from there open new frames build
new objects from an init() function called from the main function.
When the init control is returned to the init functions the application
would naturally end.

Is this the correct way to handle a desktop application and will when the init() function opens a window will the function keep control until that window is closed???

TIA
-Jim
 
Barry Andrews
Ranch Hand
Posts: 529
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on what you mean my "handles the entire application". Assuming you only have one main window, you will probably just want to extend JFrame. There you will create all your controls, hook up listeners, etc. You can just instantiate your derived JFrame in the main method and put the main method in that class. What more are you thinking the application manager class should do?
 
Chet Haase
author
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's worth noting that a framework to manage a Swing application is one of the big drivers behind the Swing Application Framework project ( https://appframework.dev.java.net/ ). It has the concept of an "Application" and handles calling back into your code to set things up (on the right GUI thread) and shut things down, handles persistent app info, resource injection...

Chet.
 
Barry Andrews
Ranch Hand
Posts: 529
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kind of like Eclipse RCP
 
Chet Haase
author
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes and No: Eclipse RCP is more comparable to the much larger NetBeans Platform framework. That system has all kinds of large-app facilities, like modules, updates, etc. The Swing app framework is much smaller and more focused on basic, boilerplate needs of even small and medium sized applications.

Chet.
 
Barry Andrews
Ranch Hand
Posts: 529
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been spending way too much time with Eclipse RCP. I didn't know this Swing Application Framework even existed. Looks pretty cool. I'll have to check it out. Thanks.
 
Romain Guy
author
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also check out NetBeans RCP. As Chet said, it comparable to Eclipse RCP but for Swing. The Swing Application Framework has a much narrower target in mind.
 
Jim Schneider
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Chet
I checked out the application framework and looks like what I am trying to do.
-Jim
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic