Results 1 to 7 of 7
- 04-12-2010, 08:21 AM #1
Passing data from one JFrame to another JFrame. - need help.
My main JFrame will open a second JFrame that has serveral input fields to gather user input and store that information in a String. Once a confirm button has been pressed I need to send that newly created String variable to the main JFrame where I can then use it for other things.
How do you send the newly created string to the main JFrame once the button is clicked?
I've tried creating a method inside the second JFrame to call for that particular String but I am not quite sure how I make the main JFrame wait until the confirm button on the second JFrame has been hit before I call that method.
Any suggestions?
- 04-12-2010, 09:03 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
- 04-12-2010, 09:33 AM #3
I've read about that while doing some research but unfortunately JDialog is beyond the scope of material covered in my classes. I also think I may lose marks if I start to venture into material that I dont fully understand or have a full grasp of.
can I design and code a JDialog just like a JFrame?
- 04-12-2010, 09:47 AM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
- 04-12-2010, 09:49 AM #5
update:
I've been doing some pokin around with the JDialog and I might actually go this route because it's providing me with exactly what I need.
JosAH can you explain to me what .dispose() does and if I should be using it when I want to hide the window?
- 04-12-2010, 10:07 AM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
The dispose() method is inherited from the Window class and it releases all the native resources used by the JDialog; when you want to (re)display it again the resources are reallocated again. It depends if you want to reuse your JDialog again after it was shown; if not, dispose() it, otherwise if memory is not a problem just set your JDialog invisible so it (re)display a bit faster later.
kind regards,
Jos
- 04-12-2010, 11:33 AM #7
Thanks Jos,
Instead of creating another posting I'm just gonna go a head and ask my next question here since its along the same lines as my topic.
Once I return from the JDialog back to the JFrame, how do I refresh element/components within the JFrame?
I'm trying to refresh a JList once I've returned back from the JDialog... in this case the JDialog is actually adding elements to teh JList's model.
I've tried .repaint(), .validate(), .updateUI() and thats with the entire JFrame and the components alone aswell. but no success.
Similar Threads
-
passing an object from one JDialog to Jframe
By sinha in forum AWT / SwingReplies: 7Last Post: 12-16-2009, 04:56 PM -
Passing data from one JFrame to another JFrame
By tarami in forum New To JavaReplies: 3Last Post: 08-06-2009, 05:44 PM -
How to make a Jframe un-focusable when another Jframe is active?
By Robert_85 in forum Advanced JavaReplies: 4Last Post: 04-22-2009, 11:02 PM -
Returning data from a JFrame/JDialog?!
By Joe2003 in forum AWT / SwingReplies: 6Last Post: 01-08-2009, 12:14 AM -
Passing data from one JFrame to another
By abhiN in forum New To JavaReplies: 2Last Post: 03-28-2008, 05:39 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks