| /* |
| * TestFrame.java |
| * |
| * Created on October 2, 2003, 10:48 AM |
| */ |
| |
| package data; |
| |
| /** |
| * |
| * @author eh103527 |
| */ |
| public class TestFrame extends javax.swing.JFrame { |
| |
| /** Creates new form TestFrame */ |
| public TestFrame() { |
| 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() {//GEN-BEGIN:initComponents |
| jPanel1 = new javax.swing.JPanel(); |
| messageL = new javax.swing.JLabel(); |
| jPanel2 = new javax.swing.JPanel(); |
| helloB = new javax.swing.JButton(); |
| closeB = new javax.swing.JButton(); |
| |
| setTitle(java.util.ResourceBundle.getBundle("data/resources/properties").getString("Test_Frame")); |
| addWindowListener(new java.awt.event.WindowAdapter() { |
| public void windowClosing(java.awt.event.WindowEvent evt) { |
| exitForm(evt); |
| } |
| }); |
| |
| jPanel1.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), "Message panel:")); |
| messageL.setFont(new java.awt.Font("Dialog", 0, 18)); |
| messageL.setText(" "); |
| jPanel1.add(messageL); |
| |
| getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); |
| |
| jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 20, 5)); |
| |
| helloB.setText(java.util.ResourceBundle.getBundle("data/resources/properties").getString("hello_button")); |
| helloB.addActionListener(new java.awt.event.ActionListener() { |
| public void actionPerformed(java.awt.event.ActionEvent evt) { |
| helloBActionPerformed(evt); |
| } |
| }); |
| |
| jPanel2.add(helloB); |
| |
| closeB.setText("Close"); |
| closeB.addActionListener(new java.awt.event.ActionListener() { |
| public void actionPerformed(java.awt.event.ActionEvent evt) { |
| closeBActionPerformed(evt); |
| } |
| }); |
| |
| jPanel2.add(closeB); |
| |
| getContentPane().add(jPanel2, java.awt.BorderLayout.NORTH); |
| |
| pack(); |
| }//GEN-END:initComponents |
| |
| private void closeBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeBActionPerformed |
| // Add your handling code here: |
| new Thread() { |
| public void run() { |
| messageL.setText(" "); |
| messageL.setForeground(java.awt.Color.RED); |
| messageL.setText("Bye bye!!"); |
| try { |
| sleep(2000); |
| } catch (Exception ex) { |
| } |
| exitForm(null); |
| } |
| }.start(); |
| }//GEN-LAST:event_closeBActionPerformed |
| |
| private void helloBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_helloBActionPerformed |
| // Add your handling code here: |
| javax.swing.SwingUtilities.invokeLater(new Runnable() { |
| public void run() { |
| messageL.setText("Hello world!!"); |
| } |
| }); |
| }//GEN-LAST:event_helloBActionPerformed |
| |
| /** Exit the Application */ |
| private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm |
| System.exit(0); |
| }//GEN-LAST:event_exitForm |
| |
| /** |
| * @param args the command line arguments |
| */ |
| public static void main(String args[]) { |
| new TestFrame().show(); |
| } |
| |
| |
| // Variables declaration - do not modify//GEN-BEGIN:variables |
| private javax.swing.JButton closeB; |
| private javax.swing.JButton helloB; |
| private javax.swing.JPanel jPanel1; |
| private javax.swing.JPanel jPanel2; |
| private javax.swing.JLabel messageL; |
| // End of variables declaration//GEN-END:variables |
| |
| } |