48 |
public ScrollBarDemo(String title) |
public ScrollBarDemo(String title) |
49 |
{ |
{ |
50 |
super(title); |
super(title); |
51 |
getContentPane().add(createContent()); |
JPanel content = createContent(); |
52 |
|
JPanel closePanel = new JPanel(); |
53 |
|
JButton closeButton = new JButton("Close"); |
54 |
|
closeButton.setActionCommand("CLOSE"); |
55 |
|
closeButton.addActionListener(this); |
56 |
|
closePanel.add(closeButton); |
57 |
|
content.add(closePanel, BorderLayout.SOUTH); |
58 |
|
getContentPane().add(content); |
59 |
} |
} |
60 |
|
|
61 |
|
/** |
62 |
|
* Returns a panel with the demo content. The panel |
63 |
|
* uses a BorderLayout(), and the BorderLayout.SOUTH area |
64 |
|
* is empty, to allow callers to add controls to the |
65 |
|
* bottom of the panel if they want to (a close button is |
66 |
|
* added if this demo is being run as a standalone demo). |
67 |
|
*/ |
68 |
JPanel createContent() |
JPanel createContent() |
69 |
{ |
{ |
70 |
JPanel content = new JPanel(new BorderLayout()); |
JPanel content = new JPanel(new BorderLayout()); |
71 |
JPanel panel = createScrollBarPanel(); |
JPanel panel = createScrollBarPanel(); |
72 |
content.add(panel); |
content.add(panel); |
|
JPanel closePanel = new JPanel(); |
|
|
JButton closeButton = new JButton("Close"); |
|
|
closeButton.setActionCommand("CLOSE"); |
|
|
closeButton.addActionListener(this); |
|
|
closePanel.add(closeButton); |
|
|
content.add(closePanel, BorderLayout.SOUTH); |
|
73 |
return content; |
return content; |
74 |
} |
} |
75 |
|
|