Salve ragazzi, avrei una domanda da porvi.

Ho una funzione di salvataggio implementata. La situazione è questa:

Ho un frame che al caricamento del programma carica un menu e un panel. Attraverso i menù stacco e attacco i panel. Il menù rimane sempre fisso.

Ora in unJpanel, è implementata la funzione che permette di salvare una serie di informazioni.

Io vorrei che quando clicco sul menu File-->Salva ttivasse quella funzione.

Come devo fare?? E' possibile????

aggangio in codice della classe principale che crea il frame col menù:

codice:
public class TestaFrame extends JFrame{
	PanelIngredienti ingredienti;
	 public TestaFrame(){

		    super("iGelato Versione 1.0");
	        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
	   //     getContentPane().setPreferredSize(new Dimension(1000, 600));
	  /*      Toolkit t = Toolkit.getDefaultToolkit();
	        Dimension screenSize = t.getScreenSize();

	        double width = screenSize.getWidth();
	        double height= screenSize.getHeight();
	        double frameWidth = width;
	        double frameHeight = height;
	        Dimension d2 = new Dimension();
	        d2.setSize(frameWidth, frameHeight);*/
	        
	        
	        Dimensione d2 = new Dimensione();
	        this.setPreferredSize(d2.DimensionePanel());
	        
	        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			this.pack();
	        this.setVisible(true);
	        this.setResizable(true);
	        MenuLookDemo22 demo = new MenuLookDemo22();
	        this.setJMenuBar(demo.createMenuBar());
	        
	        //adesso attacco al frame il pannello principale che sarà il cuore del programma
	        MainPanel mainpanel = new MainPanel();  
		    getContentPane().add(mainpanel, BorderLayout.CENTER);
	        getContentPane().validate();
	        //fine
	 }//fine testaframe
	 
	 public static void main(String[] args) {
	        SwingUtilities.invokeLater(new Runnable() {
	            public void run() {
	               TestaFrame f = new TestaFrame();
	               
	            }
	        });}//fine metodo main
	 
	 public class MenuLookDemo22{
		    public JMenuBar createMenuBar() {
		        JMenuBar menuBar;
		        JMenu menu, submenu;
		        JMenuItem menuItem;
		        JRadioButtonMenuItem rbMenuItem;
		        JCheckBoxMenuItem cbMenuItem;

		        //Create the menu bar.
		        menuBar = new JMenuBar();

		        //Build the first menu.
		        menu = new JMenu("File");
		        menuBar.add(menu);
		        menuItem = new JMenuItem("Esci",
		                KeyEvent.VK_T);
		        menuItem.addActionListener( new ActionListener() {
		           public void actionPerformed( ActionEvent e ) {
		           	    System.exit(0);
		           }//fine metodoVoid
		        });//fine actionlistener 
		        menu.add(menuItem);
		        
		        menu = new JMenu("Inserisci");
		        menuBar.add(menu);
		        menuItem = new JMenuItem("Ingredienti",
		                KeyEvent.VK_T);
		        menuItem.addActionListener( new ActionListener() {
		           public void actionPerformed( ActionEvent e ) {
		           	    getContentPane().remove(0);
		        	   PanelIngredienti ingredienti = new PanelIngredienti();
		               getContentPane().add(ingredienti, BorderLayout.CENTER);
		               getContentPane().validate();
		           }//fine metodoVoid
		        });//fine actionlistener 
		        menu.add(menuItem);
		        
		        menu = new JMenu("Visualizza");
		        menuBar.add(menu);
		        menuItem = new JMenuItem("Zuccheri Puri",
		                KeyEvent.VK_T);
		        menuItem.addActionListener( new ActionListener() {
		           public void actionPerformed( ActionEvent e ) {
		           	    getContentPane().remove(0);
		        	   PanelZuccheriPuri zuccheriPuri = new PanelZuccheriPuri();
		               getContentPane().add(zuccheriPuri, BorderLayout.CENTER);
		               getContentPane().validate();
		           }//fine metodoVoid
		        });//fine actionlistener 
		        menu.add(menuItem);
		        
		        menu = new JMenu("Modifica");
		        menuBar.add(menu);
		        menuItem = new JMenuItem("Composizione Ingredienti Compositi",
		                KeyEvent.VK_T);
		        menuItem.addActionListener( new ActionListener() {
		           public void actionPerformed( ActionEvent e ) {
		           	    getContentPane().remove(0);
		        	   PanelZuccheriCompositi zuccheriCompositi = new PanelZuccheriCompositi();
		               getContentPane().add(zuccheriCompositi, BorderLayout.CENTER);
		               getContentPane().validate();
		           }//fine metodoVoid
		        });//fine actionlistener 
		        menu.add(menuItem);
		        
		        menu = new JMenu("Bilanciamento");
		        menuBar.add(menu);
		        menuItem = new JMenuItem("Ricetta",
		                KeyEvent.VK_T);
		        menuItem.addActionListener( new ActionListener() {
		           public void actionPerformed( ActionEvent e ) {
		           	    getContentPane().remove(0);
		        	   MainPanel mainPanel = new MainPanel();
		               getContentPane().add(mainPanel, BorderLayout.CENTER);
		               getContentPane().validate();
		           }//fine metodoVoid
		        });//fine actionlistener 
		        menu.add(menuItem);
		        
		        return menuBar;

}}}//fine classe generale
questa invece è la funzione di salvataggio che adesso viene attivata da un JButton presente in un JPanel che viene incluso nel Frame principale

codice:
buttonSalva.addActionListener( new ActionListener() {
			        public void actionPerformed( ActionEvent e ) {
			        	String gelato =JOptionPane.showInputDialog("Inserisci il nome della nuova ricetta!","Nome Ricetta");
			        	System.out.println(tableModel.getDataVector());
			        		Vector v = tableModel.getDataVector();
			        		for(int t=0;t<i;t++)
			        		{
			        			String stringa = v.get(t).toString();
			        			stringa = elimina_caratteri2(stringa);
			        			System.out.println(stringa);
			        			db.eseguiAggiornamento("INSERT INTO ricettaIngredienti VALUES ('"+gelato+"','"+stringa+"' );");
			        		}
			        }});
grazie a tutti per le risposte