This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Question about generic swing JFrame structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Question about generic swing JFrame structure" Watch "Question about generic swing JFrame structure" New topic
Author

Question about generic swing JFrame structure

Mark O' Sullivan
Ranch Hand

Joined: Aug 17, 2009
Posts: 160
Hi,
I have a number of JFrames within an application and I'm to promote re usability by being easily able to add panels to these JFrames to cause the least disruption to users. There is a common panel across all JFrames and it is the bottom panel with a connect and exit button. I have a problem though. Say within a JFrame, I have 2 panels, 1 with a number of textfields that must be validated and the other panel is the bottom panel. I perform my validation in the bottom panel using the start and stop buttons. I tried to make the bottom panel generic and place the validation code in the textsfields panel. But when I called the validation code from the bottom panel which resided in the textfields panel, the validation code knew nothing about changes to the textfields, therefore at this stage, I presume the validation code must reside in the Jframe itself. What I would like to know now is, if I make a panel within JFrame(s) generic, how can I call the validation code from the generic JPanel which resides in the JFrame and is this my only possibility. This is just a private project, any help appreciated.
Mikko Kohtamäki
Ranch Hand

Joined: Dec 13, 2008
Posts: 112
Too long / comblicated explanation makes me sleepy, but

If I get this right the main problem here is the validation... how to do it properly and make it easy.

I Had problems with validation...
I was uncertain that how the validation progress is done properly and I shall share my experience and search on it... which is short

- Text Field Auto Tab - by Rob Camick, you get the picture from SizeDocumentFilter to do similar filters and using them as chains.
- Building a Swing Validation Package with InputVerifier - old but you get the message and modify it for your needs.

And I combined a bit of these two great examples i.e. bringing WantsValidationStatus to Rob's example etc.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Question about generic swing JFrame structure