All pastes #21962 Raw Edit

Miscellany

public text v1 · immutable
#21962 ·published 2005-09-02 18:38 UTC
rendered paste body
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
public class hello {

        private JFrame mainframe = null;  //  @jve:decl-index=0:visual-constraint="142,48"
        private static JPanel mainwindow = null;

        public hello() {
           // look at me. I'm a constructor
        }

        /**
         * This method initializes mainframe    
         *      
         * @return javax.swing.JFrame   
         */
        private JFrame getMainframe() {
                if (mainframe == null) {
                        mainframe = new JFrame();
                        mainframe.setSize(new java.awt.Dimension(367,173));
                        mainframe.setTitle("Blah");
                        mainframe.setContentPane(getMainwindow());
                }
                return mainframe;
        }

        /**
         * This method initializes mainwindow   
         *      
         * @return javax.swing.JPanel   
         */
        private JPanel getMainwindow() {
                if (mainwindow == null) {
                        mainwindow = new JPanel();
                        mainwindow.setLayout(new BorderLayout());
                }
                return mainwindow;
        }

        /**
         * @param args
         */
        public static void main(String[] args) {
                hello h = new hello();
                h.init();
                try {
                  Thread.sleep(100000);
                } catch(Exception ex) {
                  // actually catch interrupted exception
                  System.out.println("Got an exception");
                }
        }


        public void init() {
          this.getMainframe();
          this.getMainwindow();
          mainwindow.show();
        }


}