1 /* 2 * @(#)ToolBarTest.java 1.0 13 February 2005 3 * 4 * Copyright (c) 2004 Werner Randelshofer 5 * Staldenmattweg 2, Immensee, CH-6405, Switzerland. 6 * All rights reserved. 7 * 8 * The copyright of this software is owned by Werner Randelshofer. 9 * You may not use, copy or modify this software, except in 10 * accordance with the license agreement you entered into with 11 * Werner Randelshofer. For details see accompanying license terms. 12 */ 13 14 package test; 15 16 import java.awt.event.*; 17 import javax.swing.*; 18 /** 19 * ToolBarTest. 20 * 21 * @author Werner Randelshofer 22 * @version 1.0 13 February 2005 Created. 23 */ 24 public class ToolBarTest extends javax.swing.JPanel { 25 26 /** Creates new form. */ ToolBarTest()27 public ToolBarTest() { 28 initComponents(); 29 toolBar1.addSeparator(); 30 toolBar1.add(new AbstractAction("Action") { 31 public void actionPerformed(ActionEvent evt) { 32 33 } 34 }); 35 toolBar2.addSeparator(); 36 toolBar2.putClientProperty("JToolBar.isRollover",Boolean.TRUE); 37 } 38 39 /** This method is called from within the constructor to 40 * initialize the form. 41 * WARNING: Do NOT modify this code. The content of this method is 42 * always regenerated by the Form Editor. 43 */ initComponents()44 private void initComponents() {//GEN-BEGIN:initComponents 45 toolBar1 = new javax.swing.JToolBar(); 46 jLabel1 = new javax.swing.JLabel(); 47 jButton1 = new javax.swing.JButton(); 48 jToggleButton1 = new javax.swing.JToggleButton(); 49 jCheckBox1 = new javax.swing.JCheckBox(); 50 jComboBox1 = new javax.swing.JComboBox(); 51 jPanel1 = new javax.swing.JPanel(); 52 toolBar2 = new javax.swing.JToolBar(); 53 jLabel2 = new javax.swing.JLabel(); 54 jButton2 = new javax.swing.JButton(); 55 jToggleButton2 = new javax.swing.JToggleButton(); 56 jCheckBox2 = new javax.swing.JCheckBox(); 57 jComboBox2 = new javax.swing.JComboBox(); 58 59 setLayout(new java.awt.BorderLayout()); 60 61 jLabel1.setText("jLabel1"); 62 jLabel1.setAlignmentX(0.5F); 63 toolBar1.add(jLabel1); 64 65 jButton1.setText("jButton1"); 66 jButton1.setAlignmentX(0.5F); 67 toolBar1.add(jButton1); 68 69 jToggleButton1.setText("jToggleButton1"); 70 jToggleButton1.setAlignmentX(0.5F); 71 toolBar1.add(jToggleButton1); 72 73 jCheckBox1.setText("jCheckBox1"); 74 jCheckBox1.setAlignmentX(0.5F); 75 toolBar1.add(jCheckBox1); 76 77 jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "jComboBox" })); 78 toolBar1.add(jComboBox1); 79 80 add(toolBar1, java.awt.BorderLayout.NORTH); 81 82 jPanel1.setLayout(new java.awt.BorderLayout()); 83 84 toolBar2.setName("ToolBar with Title"); 85 jLabel2.setText("jLabel1"); 86 jLabel2.setAlignmentX(0.5F); 87 toolBar2.add(jLabel2); 88 89 jButton2.setText("jButton1"); 90 jButton2.setAlignmentX(0.5F); 91 toolBar2.add(jButton2); 92 93 jToggleButton2.setText("jToggleButton1"); 94 jToggleButton2.setAlignmentX(0.5F); 95 toolBar2.add(jToggleButton2); 96 97 jCheckBox2.setText("jCheckBox1"); 98 jCheckBox2.setAlignmentX(0.5F); 99 toolBar2.add(jCheckBox2); 100 101 jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "jComboBox" })); 102 toolBar2.add(jComboBox2); 103 104 jPanel1.add(toolBar2, java.awt.BorderLayout.NORTH); 105 106 add(jPanel1, java.awt.BorderLayout.CENTER); 107 108 }//GEN-END:initComponents 109 110 111 // Variables declaration - do not modify//GEN-BEGIN:variables 112 private javax.swing.JButton jButton1; 113 private javax.swing.JButton jButton2; 114 private javax.swing.JCheckBox jCheckBox1; 115 private javax.swing.JCheckBox jCheckBox2; 116 private javax.swing.JComboBox jComboBox1; 117 private javax.swing.JComboBox jComboBox2; 118 private javax.swing.JLabel jLabel1; 119 private javax.swing.JLabel jLabel2; 120 private javax.swing.JPanel jPanel1; 121 private javax.swing.JToggleButton jToggleButton1; 122 private javax.swing.JToggleButton jToggleButton2; 123 private javax.swing.JToolBar toolBar1; 124 private javax.swing.JToolBar toolBar2; 125 // End of variables declaration//GEN-END:variables 126 127 } 128