Results 1 to 3 of 3
Thread: MultiPle JFrame problems
- 08-26-2009, 02:20 AM #1
Member
- Join Date
- Aug 2009
- Posts
- 66
- Rep Power
- 0
MultiPle JFrame problems
I had two JFrames (the first one called A.java -> had a JTable on it, and the second one called B.java -> used to add Items to JTable for A.java)
When I pressed the Add Items (JButton), A.java poped B.java up (using setVisible).
The problem was, when B.java successfully inputed items to database, A.java didn't want to refresh it's JTable (because of diffrent JFrame)
A.java pop up B.java, B.java successfully had done it's job, but A.java didn't want to refresh it's JTable because of diffent JFrame.
################################################## ###
Another problem :
I want to check who is login, so I create a private variable in a class, using a setter and getter on it.
In another class (another Jframe), I used to call for the last class which contained that private variable, but it seems to be failed to access the value from the last class.
Any examples solutions for my problem? thanks.
-
The easiest way to solve this is not to use two JFrames but instead have your main window with the JTable be a JFrame and pop up either a JOptionPane or a modal JDialog that requests information from the user. The code calling the option pane or modal dialog will stop processing until the user enters their information into the dialog and closes it. The calling class can then extract this information from the dialog's components (JTextFields or whatever) and use this to update the JTable that it's holding.I had two JFrames...
I'm assuming of course that you know how to use table models such as a DefaultTableModel to update your JTable. If not, please read the Sun tutorial on JTables and table models.
Without code it's impossible to tell why this program is not working.Another problem
-
If you are still unsure, why not post some of your code in here and we can take a look at it. It would be most helpful if that code were small, compilable and runnable -- a small self-contained program that demonstrates your problem, otherwise known as an SSCCE.
Similar Threads
-
Multiple Panels in JFrame or JPanel
By DavidG24 in forum AWT / SwingReplies: 5Last Post: 05-16-2009, 12:47 PM -
problems with JPanel and JFrame
By v1nsai in forum New To JavaReplies: 13Last Post: 04-08-2009, 07:49 PM -
Adding Multiple Panels and Single Scroll bar on the JFrame
By SANDY_INDIA in forum AWT / SwingReplies: 6Last Post: 07-28-2008, 06:04 PM -
Can't synchronize multiple JPanels in a JFrame
By vassil_zorev in forum AWT / SwingReplies: 0Last Post: 12-30-2007, 04:22 PM -
problems with jDialog in a JFrame
By bbq in forum AWT / SwingReplies: 1Last Post: 07-05-2007, 04:14 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks