sono riuscito a risolvere
System.exit(0);
molto banalmente
ora devo trovare un modo che mi riesca a far chiudere un JInternalFrame, ma spulciando bene la documentazione qualcosa troverò sicuramente
per quanto riguarda la classe che stavo implementando, ti posto il codice intero così ti fai un'idea:
codice:/* * FlowConfigView.java * * Created on 8 aprile 2008, 17.48 */ package app; /** * * @author ethereal */ public class FlowConfigView extends javax.swing.JFrame { /** Creates new form FlowConfigView */ public FlowConfigView() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { menuPrincipale = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); newFlowMenuItem = new javax.swing.JMenuItem(); openFlowMenuItem = new javax.swing.JMenuItem(); exitMenuItem = new javax.swing.JMenuItem(); helpMenu = new javax.swing.JMenu(); aboutMenuItem = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); fileMenu.setText("File"); newFlowMenuItem.setText("New Flow"); newFlowMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newFlowMenuItemActionPerformed(evt); } }); fileMenu.add(newFlowMenuItem); openFlowMenuItem.setText("Open Flow"); openFlowMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { openFlowMenuItemActionPerformed(evt); } }); fileMenu.add(openFlowMenuItem); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); fileMenu.add(exitMenuItem); menuPrincipale.add(fileMenu); helpMenu.setText("Help"); aboutMenuItem.setText("About..."); aboutMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { aboutMenuItemActionPerformed(evt); } }); helpMenu.add(aboutMenuItem); menuPrincipale.add(helpMenu); setJMenuBar(menuPrincipale); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(0, 278, Short.MAX_VALUE) ); pack(); }// </editor-fold> private void newFlowMenuItemActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void openFlowMenuItemActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new FlowConfigView().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JMenuItem aboutMenuItem; private javax.swing.JMenuItem exitMenuItem; private javax.swing.JMenu fileMenu; private javax.swing.JMenu helpMenu; private javax.swing.JMenuBar menuPrincipale; private javax.swing.JMenuItem newFlowMenuItem; private javax.swing.JMenuItem openFlowMenuItem; // End of variables declaration }
trovi delle ridondanze? qualcosa che non avrei dovuto mettere?


Rispondi quotando