Question:

Help with Java code ... plz?

by  |  earlier

0 LIKES UnLike

I wrote a very simple program but the program hangs and crashes after a few seconds even though it works as its supposed to

import javax.swing.*;

public class Hello

{

public void initGUI()

{

JFrame frame =new JFrame("Java app");

frame.setDefaultCloseOperation

(JFrame.EXIT_ON_CLOSE);

frame.setSize(800,600);

frame.setVisible(true);

}

public static void main(String[] args)

{

javax.swing.

SwingUtilities.invokeLater

(new Runnable(){

public void run()

{

Hello hello =new Hello();

hello.initGUI();

}

});

}

}

Any help on how to fix this would be appreciated =)

 Tags:

   Report

1 ANSWERS


  1. I find absolutely no fault with your program. I executed your program and Let it be so for more than 5 minutes. It doesn't hang or crash. Check your J2SE Version. I use JDK1.6

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.