tags:

views:

352

answers:

3

Hi everyone. Some background on myself. Former AS/400 guy, recently downsized and unemployed. Taking this opportunity to learn java. I’m fairly new to Java and Netbeans. Since I’m unemployed and not in an organization with ‘experts’, I’m trying to find resources for help. I’m in ATLanta so I’ve joined www.ajug.org in hopes of networking with folks to find resources. I’ve also applied for some 'Obama Bucks' in order to take some classes. Until then I was hoping to ask you "Good Folks" for some help!

I’ve developed the security structure and a dynamic menu for a SWING application that uses MySQL. I’ve developed lots of SWING apps and compiled the classes that perform TABLE maintenance (Insert/Update/Delete) on the TABLES my application will use. NOW, I’m getting into the ‘nitty-gritty’ of the application. I’m continuing to stumble over ‘pretty simple stuff’ that I believe a ‘SWING Application Architect’ or one of you Netbeans/SWING experts could readily answer.

Concerning Netbeans and Returning a value from a SWING class.
Netbeans creates two or more .java files in my projects.
Example: desktopapplication project contains - DesktopApplicationApp.java and - DesktopApplicationView.java Normally, DesktopApplicationApp.java launches() itself and then in startup() it does a show(new DesktopApplicationView(this)). I have several "look up" TABLES tables and want to create separate classes that allow the user to search through the TABLE a return a row. (This is OOP, right!?) So if I have an application (DesktopApplicationApp and DesktopApplicationView) and I want use another CLASS SelectValueApp to search a database and return a key value to DesktopApplicationView.

My "Menu Program" just does an execCMD() to run the Classes in my application.

For "CALLING" SelectValueApp from DesktopApplicationView I know I should use a constructor and create an instance of SelectValueApp .... but what method do I use to "retrieve the key" from the class?

Can I just Launch() the SelectValueView from DesktopApplicationView? I read, "Using the Swing Application Framework(JSR296)" and I’m still not clear on how to do this. I’m thinking that when SelectValueApp completes the EXIT() it will cause a shutdown of the JVM (And kill DesktopApplicationView).

I could include the functionality of SelectValueView in DesktopApplicationView but this program is already HUGE!

So I’ve a bunch of questions. 1) How do I accomplish this? (please). Also, I’ve referenced these posts and they are "very Close" to what I need to know.
questions/1091389/how-to-transfer-objects-from-jframe-to-another-jframe questions/573317/java-swing-close-window-without-exiting-app questions/573378/managing-parent-frame-from-child-frame-on-java-swing

2) Is it a limitation of "SingleFrameApplication"? (Trying to open another frame to return the value) 3) Do I have to put all the functionality in the MyApplicationView? 4) Or does the code that Netbeans generates just make this tough and there is a simple, elegant way to accomplish this?

ALSO, I’ll create a Short, Self Contained, Correct (Compilable), Example (SSCCE) and update this post

Thanking you in advance,

Current Java Newbie / Future Java CSD and Java Heavyweight,

+1  A: 

I'm not sure that many projects use the Swing Application Framework. It's way immature IMHO

and companies already have their "own" frameworks or solutions for speed up development or

deal with common annoyances.

I would suggest to look at the JSR296 documentation in details.

By the way, you don't have to tell us your whole background, people will help you if they can/want.

I already read and re-read and re-read JSR296. But Thank You. However, I've decided based on my short 72-hour debugging session. that there is absolutely NO WAY to accomplish this. Once the second class PickValue() is .setVisible(true) a new EDT is started .... you can never get a retun value. Anyway, I intend to employ either MQ/Series or a socket listener for the classes to communicate. I will research some of the ways IPC (Inter Process Communication) is commonly implemented. Hopefully I can get proof of concept in the next 24 hours. THANKS Again!
`PickValue`'s `setVisible()` method should only block if `PickValue` is a modal dialog. It sounds to me like for this application, it'd be better if it was non-modal, or even an independent `JFrame`. So long as it's not modal, both windows should share the same EDT.
David Moles
A: 

The Swing Application Framework is dead in the water -- from what I hear, most of the developers have been moved over to JavaFX.

As for your general design problem -- is there a reason that the different pieces need to be separate applications? My instinct is that you don't need to do that, and that therefore you don't need a socket listener, you just need callbacks so the classes that need to talk to each other can do so in an event-driven way.

David Moles
A: 

Maybe a better choice is Spring Rich Client?

Or even one of this list: http://karussell.wordpress.com/2009/10/08/java-application-frameworks-not-only-client-side/

??

Karussell