• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Save Button

 
Vito Ganci
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Morning, I had build a Main Form with a MenuBar, in this MainForm I had put a layeredpane where I show a JInternalFrame.
In my MenuBar I had put a JButton (Save); I would like that when I click on button Save I can retrieve the data from the JInternalFrame showing.
How I can do?
 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Morning,

for all your posts, everywhere ---> for better help sooner post an SSCCE, short, runnable, compilable, just about a.m. issue
 
Vito Ganci
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have understand my problem? Can you help me?
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.
Usually one would put a JMenuItem on the JMenuBar (unless of course you are using a JToolBar) and listen to the menu selection to trigger off the required action.
More on building and using menus here http://docs.oracle.com/javase/tutorial/uiswing/components/menu.html
 
Vito Ganci
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had write wrong, In the my menu I have a menu item, but the problem is how to retrieve data from the active internal frame when click on menu itmem?
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Impossible to say without seeing your code. Post your SSCCE (<-link; click to find out what it means) so we can take a look
 
Vito Ganci
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my main class where there is the menu


here I open a JInternalFrame



The Internal Frame have many JtextField ie JTextField1, JTextField2 that the user fill

now from my memù item I would like to retrive this values:
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code you posted is useless for us. We cannot download compile or run it on our machines.
Did you take a look at the SSCCE link like I requested? Here it is one more time. http://sscce.org/
Please post a proper SSCCE
 
Campbell Ritchie
Sheriff
Pie
Posts: 49793
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am afraid, I think you are going around this the wrong way entirely. What you have done is create a button and ask that button to save. What you need to do is work out how to sve something without the button. Create an object which encapsulates all the data from the internal frame, and save that, using the command line only.
When you have a class with a public save() method, you can call it from the buttonNote there is a special condition: if myModel is a local variable or parameter, it will probably have to be marked final.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic