problems with AWT Panel

Could anyone tell me what's wrong with the following code?
How can I make dresscheck appear ,after Quitbutton is clicked, without having to resize the window?

Thanks,
Supi

*******

import java.awt.*;
import java.applet.*;
import java.awt.event.*;

public class Test extends Applet{

    public Panel appletPanel, eventPanel, clothesPanel, buttonPanel;
    public Button submitButton, quitButton;
    public Checkbox dressCheck, suitCheck;
    public Checkbox dinnerCheck, concertCheck;
    public CheckboxGroup chkGroup1, chkGroup2;

    public void init(){

        setLayout(new BorderLayout());

        /* buttons */
        buttonPanel = new Panel();
        submitButton = new Button("Submit");
        quitButton = new Button("Quit");
        buttonPanel.add(submitButton);
        buttonPanel.add(quitButton);

        /* events */
        eventPanel = new Panel();
        dinnerCheck = new Checkbox("Dinner", chkGroup1, true);
        concertCheck = new Checkbox("Concert", chkGroup1, false);
        eventPanel.add(dinnerCheck);
        eventPanel.add(concertCheck);

        /* clothes */
        clothesPanel = new Panel();
        dressCheck = new Checkbox("Dress", chkGroup2, true);
        suitCheck = new Checkbox("Suit", chkGroup2, false);
        clothesPanel.add(dressCheck);
        clothesPanel.add(suitCheck);

        appletPanel = new Panel();
        appletPanel.setLayout(new BorderLayout());

        appletPanel.add(eventPanel, BorderLayout.CENTER);
        appletPanel.add("South", buttonPanel);
        add(appletPanel, BorderLayout.CENTER);

        submitButton.addActionListener(new ActionListener(){

            public void actionPerformed(ActionEvent e){

                eventPanel.remove(dinnerCheck);
            }
        });

        quitButton.addActionListener(new ActionListener(){

            public void actionPerformed(ActionEvent e){

                eventPanel.add(dressCheck);
                appletPanel.setLayout(new BorderLayout());
                appletPanel.repaint();
                repaint();
                paint(getGraphics());
            }
        });


    }



}
supiAsked:
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.

sen_kumCommented:
Add  the line in quitButton's actionListener's actionPerfomed function

    Test.this.validate() ;


import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Test extends Applet{

    public Panel appletPanel, eventPanel, clothesPanel, buttonPanel;
    public Button submitButton, quitButton;
    public Checkbox dressCheck, suitCheck;
    public Checkbox dinnerCheck, concertCheck;
    public CheckboxGroup chkGroup1, chkGroup2;

    public void init(){

        setLayout(new BorderLayout());

        /* buttons */
        buttonPanel = new Panel();
        submitButton = new Button("Submit");
        quitButton = new Button("Quit");
        buttonPanel.add(submitButton);
        buttonPanel.add(quitButton);

        /* events */
        eventPanel = new Panel();
        dinnerCheck = new Checkbox("Dinner", chkGroup1, true);
        concertCheck = new Checkbox("Concert", chkGroup1, false);
        eventPanel.add(dinnerCheck);
        eventPanel.add(concertCheck);

        /* clothes */
        clothesPanel = new Panel();
        dressCheck = new Checkbox("Dress", chkGroup2, true);
        suitCheck = new Checkbox("Suit", chkGroup2, false);
        clothesPanel.add(dressCheck);
        clothesPanel.add(suitCheck);

        appletPanel = new Panel();
        appletPanel.setLayout(new BorderLayout());

        appletPanel.add(eventPanel, BorderLayout.CENTER);
        appletPanel.add("South", buttonPanel);
        add(appletPanel, BorderLayout.CENTER);

        submitButton.addActionListener(new ActionListener(){

            public void actionPerformed(ActionEvent e){

                eventPanel.remove(dinnerCheck);
            }
        });

        quitButton.addActionListener(new ActionListener(){

            public void actionPerformed(ActionEvent e){

                eventPanel.add(dressCheck);
                Test.this.validate() ;
            }
        });


    }
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.