public class Container extends Component
Some of the commonly used Container class methods are:
public class Panel extends Container implements Accessible
public class Window extends Container implements Accessible
public class Frame extends Window implements MenuContainer
To create a frame without a title bar, use Frame() constructor that does not have any arguments.Frame f = new Frame();
Window title can be declared using strings as below:
Frame f = new Frame("Window Title");
A component can be added to a frame by using add() method. For example,
Frame f = new Frame("Example Window");
f.add(new Button("Correct");
Otherwise this can be used, if present inside the class.
this.f(new Button("Correct");
A Frame can be given a size using the setsize() method. For example,
f.setsize(150,100);
After adding all the required components , it must be made visible as it is initially set to invisible. This can be done by using setVisible() method. For example,
f.setVisible(true);
Otherwise if one wants the exact size, use pack()
method. public class Dialog extends Window