| /* * DemoGUI.java * * Created on 1 August 2003, 21:30 */ /** * * @author Zankhana */ public class DemoGUI extends javax.swing.JFrame { /** Creates new form DemoGUI */ public DemoGUI() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ |
|
private void initComponents() { buttonPanel = new javax.swing.JPanel(); testButton = new javax.swing.JButton(); demoLabel = new javax.swing.JLabel(); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } }); testButton.setText(" Click Me !"); buttonPanel.add(testButton); getContentPane().add(buttonPanel, java.awt.BorderLayout.SOUTH); demoLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); getContentPane().add(demoLabel, java.awt.BorderLayout.CENTER); pack(); } |
/** Exit the Application */ private void exitForm(java.awt.event.WindowEvent evt) { System.exit(0); } /** * @param args the command line arguments */ public static void main(String args[]) { new DemoGUI().show(); } |
|
// Variables declaration - do not modify private javax.swing.JLabel demoLabel; private javax.swing.JButton testButton; private javax.swing.JPanel buttonPanel; // End of variables declaration |
| } |
|
testButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { testButtonActionPerformed(evt); } }); |
|
private void testButtonActionPerformed(java.awt.event.ActionEvent evt) { // Add your handling code here: demoLabel.setText ("You clicked on the Test Button.") ; } |