TERMINATING MAIN THREADS

Below are my main and my GUI class.
i would like the main the terminate when i close the GUI. That is what i am trying to by including

 this.addWindowListener (  new WindowAdapter()
                {
                    public void windowClosing(WindowEvent e)
                    {
                        setVisible(false);
                        dispose();
                        System.exit(0);}} );
But i notice in my Tast list that the java.exe is still there after i close the window.
Why should i do.

==================== MAIN  ====================
{
   
    /** Creates a new instance of Main */
    public Main()
    {
    }
   
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
       
     javax.swing.SwingUtilities.invokeLater
     (
        new Runnable()
        {
            public void run()
            {
               new DisplayCdCollection();
            }
        }
     );
       
    }
}
======================= GUI CLASS ====================
public class DisplayCdCollection extends JFrame
{
 
    private String selectedGenre;
    private JComboBox categories;
    private JTextArea CdList;
    private final String genres[] ;
   
    private CDCollection CDs;
     
    public DisplayCdCollection()
       {  
            super("CDs Display");
           
            CDs = new CDCollection();
            //CDs.read();
            genres = CDs.getCdCategoies();
                                   
            this.setLocation(300,300 );
            this.addWindowListener
            (
                new WindowAdapter()
                {
                    public void windowClosing(WindowEvent e)
                    {
                        setVisible(false);
                        dispose();
                        System.exit(0);
                    }
                }
            );
 
            //creating JTextArea to display the CDS
            CdList = new JTextArea("list of cd");
            CdList.setEditable(false);
           
            //create a contianer with scrollbar where the CdList should go.
            Container c = getContentPane();
            c.setLayout(new BorderLayout());
            c.add(new JScrollPane(CdList), BorderLayout.CENTER);
           
            /**creating combobox to hold the type of CD */
            categories = new JComboBox(genres);
            categories.setBackground(Color.white);
            categories.setMaximumRowCount(12);
           
            /**
             *add a listner to the combobox. When a genre of CD is chosen a
             *the selection will automatically trigger a processing of a list
             *of CDs of that type.
             */
            categories.addItemListener
            (
                new ItemListener()
                {
                    public void itemStateChanged(ItemEvent e)
                    {
                     selectedGenre= (String)categories.getSelectedItem();
                        {
                            if( selectedGenre.equals("All") )
                            {
                               CdList.setText("");
                               CdList.setText( CDs.printAll() );
                             }
                            else
                             {
                              CdList.setText("");
                              CdList.setText( CDs.getCDList(selectedGenre) );
                            }
                               
                        }
                    }
                }
            ); //end of addItemListener

        //creat a panel for the Cd categories combobox
        JPanel eastPanel = new JPanel();
        eastPanel.add(categories);
        c.add(eastPanel, BorderLayout.EAST);
           
        setSize(250,100);
        show();
    }
}

 
komlaaaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

objectsCommented:
its probably java running something else on your computer.
does the app you are running finsh?

0
objectsCommented:
btw instead of using a listener as you are currently doing you can instead just use:

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.