01: package examples.swingdemos;
02:
03: import java.awt.*;
04:
05: import javax.swing.*;
06:
07: public class ToolBarDemo extends JFrame {
08: JToolBar jToolBar1 = new JToolBar();
09: JButton jButton1 = new JButton();
10: JRadioButton jRadioButton1 = new JRadioButton();
11: JLabel jLabel1 = new JLabel();
12: JTextArea jTextArea1 = new JTextArea();
13: JButton jButton2 = new JButton();
14:
15: public ToolBarDemo() {
16: jbInit();
17: }
18:
19: private void jbInit() {
20: this .getContentPane().setLayout(new GridLayout(0, 1));
21:
22: jButton1.setText("jButton1");
23: jRadioButton1.setText("jRadioButton1");
24: jLabel1.setText("jLabel1");
25: jTextArea1.setText("jTextArea1");
26: jButton2.setText("jButton2");
27:
28: jToolBar1.add(jButton1, null);
29: jToolBar1.add(jButton2, null);
30: jToolBar1.add(jTextArea1, null);
31: jToolBar1.add(jRadioButton1, null);
32: jToolBar1.add(jLabel1, null);
33:
34: this .getContentPane().add(jToolBar1);
35: }
36:
37: public static void main(String[] args) {
38: ToolBarDemo frame = new ToolBarDemo();
39: frame.pack();
40: frame.setVisible(true);
41: }
42:
43: }
|