Consider the following code:
import ......
......
public class sample extends Applet
{
public void init()
{
//initialize variables
add(yes);//.....GUI components
add(no);//.....GUI components
//yes & no are checkboxes in a group
}
public void removecomponents()
{
//this method removes the GUI components
//previously added
//by the init() method
}
public void displaycomponents()
{
//initialize other variables
Graphics dg=getGraphics();
add....//other components
add....//other components
}
public void itemStateChanged(ItemEvent ie)
{
//Here I have written code that checks which
//checkbox is selected, then executes further
//code accordingly
displaycomponents();
//When this method is called the Applet should
//display the newly added components
//However the applet displays the newly added
//components only after minimizing & maximizing
//it.
}
What can be done to make the applet display the newly
added components immediately?