Ciao a tutti!

Sono di nuovo io.

Vorrei creare una finestra che ha al suo interno una JTable e 2 JButton uno OK e uno Annulla. Il bottone OK deve eseguire delle istruzioni e poi chiudere la finestra mentre il bottone annulla deve semplicemente chiudere la finestra.

Ho cercato di capire come fare leggendo qualche guida e guardando un po' di codice creato da NetBeans ma sinceramente non riesco a farlo.

Il codice che ho creato è questo:

codice:
public class FileSelector extends JFrame{
    /**
     * Create the GUI and show it.  For thread safety,
     * this method should be invoked from the
     * event-dispatching thread.
     */
	

	
    private static void createAndShowGUI() {
        //Create and set up the window.    	
    	JFrame frame = new JFrame("File Selector");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JButton buttonOk = new JButton("OK");
        JButton buttonAnnulla = new JButton("Annulla");
        
        
        
        TableModel fileTable = new FileTableModel("file");
		JTable table = new JTable(fileTable);
		table.setColumnSelectionAllowed(true);
		JScrollPane scrollPane = new JScrollPane(table);
		
		frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
        frame.getContentPane().add(buttonOk, BorderLayout.SOUTH);
        //frame.getContentPane().add(buttonAnnulla, BorderLayout.SOUTH); 
        //l'ho dovuta commentare perchè se no me lo sovrapponeva al bottone precedente
        

        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }
    
    
    
    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
}
Qualcuno mi sa dire che oggetti devo usare e che metodi devo implementare per rendere "attivi" i JButton??

Grazie mille!

mainetz.