- importjava.awt.EventQueue;
- importjavax.swing.JFrame;
- publicclass MainWindow {
- privateJFrame frame;
- /**
- * Launch the application.
- */
- publicstaticvoid main(String[] args){
- EventQueue.invokeLater(newRunnable(){
- publicvoid run(){
- try{
- MainWindow window =new MainWindow();
- window.frame.setVisible(true);
- }catch(Exception e){
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public MainWindow(){
- initialize();
- }
- /**
- * Initialize the contents of the frame.
- */
- privatevoid initialize(){
- frame =newJFrame();
- frame.setBounds(100, 100, 511, 402);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- }
↧
How do you create a simple Swing based Window with Frame?
↧