|
BUTTONS
A panel is a type
of container from the panel class. Purpose of a panel is to create
more advanced layouts in a rectangular form. You can use a panel
to hold components; such as a button, also you can create a group
of components that all have the same appearance.
Panels can be placed within other panels or other containers such
as other panels or frames. A panel has no borders giving it the
ability to blend in with the background. The default layout manager
is FlowLayout, which will center components and maintain it intended
size.
Panel
Mypanel = new Panel( );
//constructor this creates a panel //from
the Panel class called Mypanel.
//This is done by calling the add method
Mypanel.add(new Button(“ Button”));
These components can be arranged by specifying where you want
the components to lye within the panel, such as: South, North,
Center, East and West.
Mypanel. Add(“South”,
new Button(“Button2”);
|
|