CardPanelpublic class CardPanel extends Panel
Fields Summary |
---|
ActionListener | listener |
Constructors Summary |
---|
CardPanel(ActionListener actionListener)
listener = actionListener;
setLayout(new CardLayout());
add("one", create(new FlowLayout()));
add("two", create(new BorderLayout()));
add("three", create(new GridLayout(2, 2)));
add("four", create(new BorderLayout(10, 10)));
add("five", create(new FlowLayout(FlowLayout.LEFT, 10, 10)));
add("six", create(new GridLayout(2, 2, 10, 10)));
|
Methods Summary |
---|
java.awt.Panel | create(java.awt.LayoutManager layout)
Button b = null;
Panel p = new Panel();
p.setLayout(layout);
b = new Button("one");
b.addActionListener(listener);
p.add("North", b);
b = new Button("two");
b.addActionListener(listener);
p.add("West", b);
b = new Button("three");
b.addActionListener(listener);
p.add("South", b);
b = new Button("four");
b.addActionListener(listener);
p.add("East", b);
b = new Button("five");
b.addActionListener(listener);
p.add("Center", b);
b = new Button("six");
b.addActionListener(listener);
p.add("Center", b);
return p;
| public java.awt.Dimension | getPreferredSize()
return new Dimension(200, 100);
|
|