Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JFrame loads Frame then both frames go slow and unresponsive

843789Dec 22 2009 — edited Dec 23 2009
Java 6 (1.6.1.17)
Netbeans IDE 6.7.1
Windows XP Professional SP3

Hi i have a jFrame with 1 jButton on it, when i clcik it i want it to load another frame and it does but it seems when the jFrame loads the Frame they both become slow, the Frame has a textbox on it and i cannot even type into it because it s too slow. But if i make the Frame load straight away without having to use the jFrame or click the button then it all loads Ok. Do you know if this is a common problem??, I put some code in to be executed after the jButton is pressed and the Frame has loaded but it never does get processed (System.out....blah blah). its like it goes in a loop or something after the jFrame loads the Frame.

This is the code in the button:
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
try {Client c=new Client(new ChatApplet());
    c.login(txtUserName.getText(),"Guest Account",null,txtJavaChatIP.getText());
} catch (InterruptedException iae) {
} catch (IOException ioe) {
}

System.out.println("It never processes this code here but the above code always gets processed");
    }  
Ok the Client class connects to the Webserver and the ChatApplet class has the Frame on it with the textbox etc.
Now it does login Ok, and then the ChatApplet Frame loads up, but from there on its slow, like the Textbox to type a message to all users in the chat etc you can hardly write in it. im thinking because its re-creating the frame in a loop or something.

But if i put all the code in the jButton on a class file with a Main method. and run it it all works fine! so it has to be the jFrame.

Im useing NetBeans by the way.

Please try and help me with this!
Thank youuu!

Edited by: Valtros on Dec 22, 2009 7:42 AM

Edited by: Valtros on Dec 22, 2009 7:45 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 20 2010
Added on Dec 22 2009
11 comments
981 views