private JButton getBtnClose ( ) { if ( btnClose == null ) { btnClose = new JButton ( ) ; btnClose . setText ( "Close" ) ; btnClose . setVisible ( false ) ; btnClose . addActionListener ( new ActionListener ( ) { // Close this window @ Override public void actionPerformed ( ActionEvent arg0 ) { stop ( ) ; } } ) ; } return btnClose ; }
This method initializes jButton1