Page 208 - CTS - CSA TP - Volume 2
P. 208

COMPUTER SOFTWARE APPLICATION - CITS






                      // now frame will be visible, by default it is not visible
                      setVisible(true);


                      // Adding window close event handling
                      addWindowListener(new java.awt.event.WindowAdapter() {

                          public void windowClosing(java.awt.event.WindowEvent windowEvent) {
                              System.exit(0);
                          }
                      });

                  }


                  // main method
                  public static void main(String args[]) {


                      // creating instance of Frame class

                      ButtonExample f = new ButtonExample();
                  }
              }



           Output:











































                                                           193

                              CITS : IT & ITES - Computer Software Application - Exercise 116
   203   204   205   206   207   208   209   210   211   212   213