1 19 20 package examples.texteditor; 21 22 public class About extends javax.swing.JDialog { 23 24 25 public About(java.awt.Frame parent) { 26 super (parent, true); 27 initComponents (); 28 pack (); 29 } 30 31 36 private void initComponents() { jTextField1 = new javax.swing.JTextField (); 38 jMenuBar1 = new javax.swing.JMenuBar (); 39 jMenu1 = new javax.swing.JMenu (); 40 jMenuItem1 = new javax.swing.JMenuItem (); 41 42 setTitle("About"); 43 addWindowListener(new java.awt.event.WindowAdapter () { 44 public void windowClosing(java.awt.event.WindowEvent evt) { 45 closeDialog(evt); 46 } 47 }); 48 49 jTextField1.setEditable(false); 50 jTextField1.setText("Ted the Text Editor."); 51 getContentPane().add(jTextField1, java.awt.BorderLayout.CENTER); 52 53 jMenu1.setText("About"); 54 jMenuItem1.setText("Close"); 55 jMenuItem1.addActionListener(new java.awt.event.ActionListener () { 56 public void actionPerformed(java.awt.event.ActionEvent evt) { 57 jMenuItem1ActionPerformed(evt); 58 } 59 }); 60 61 jMenu1.add(jMenuItem1); 62 jMenuBar1.add(jMenu1); 63 setJMenuBar(jMenuBar1); 64 65 } 67 private void jMenuItem1ActionPerformed (java.awt.event.ActionEvent evt) { closeDialog(null); 70 } 72 73 74 private void closeDialog(java.awt.event.WindowEvent evt) { setVisible (false); 76 dispose (); 77 } 79 80 private javax.swing.JTextField jTextField1; 82 private javax.swing.JMenuItem jMenuItem1; 83 private javax.swing.JMenuBar jMenuBar1; 84 private javax.swing.JMenu jMenu1; 85 87 88 89 } 90 | Popular Tags |