Results 1 to 3 of 3
- 12-12-2011, 06:31 PM #1
Member
- Join Date
- Mar 2011
- Posts
- 14
- Rep Power
- 0
Append to JTextArea instantly Problem
I got this GUI, and when I click the button, this is its action:
Java Code:public void startServer() { ServerSocket ss = null; if(jButton1.getText().equals("Start")){ try{ jButton1.setText("Stop"); taMessages.append("Starting the server..\r\n"); ss = new ServerSocket(50000); taMessages.append("The server started at port: " + ss.getLocalPort() + "\r\n"); System.out.println("Starting the server.."); while(true){ try{ Socket s = ss.accept(); taMessages.append("A client has connected!"); ClientThread ct = new ClientThread(s); ct.start(); }catch(Exception e){ System.out.println(e); } } }catch(Exception e){ System.out.println(e); } }else{ try{ jButton1.setText("Start"); taMessages.append("Server Stopped!\r\n"); ss.close(); }catch(Exception e){ System.out.println(e); } } }
I read about EDT and other issues related to this, but I can't simply understand them.. Can someone help me?
- 12-12-2011, 07:05 PM #2
Re: Append to JTextArea instantly Problem
Have you gone through Lesson: Concurrency in Swing (The Java™ Tutorials > Creating a GUI With JFC/Swing) ? If you have, and still don't understand what you need to do, it's rather doubtful that anybody here would be able to help you either.
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
- 12-17-2011, 07:50 PM #3
Senior Member
- Join Date
- Aug 2009
- Location
- Pittsburgh, PA
- Posts
- 285
- Rep Power
- 12
Similar Threads
-
Problem in JtextArea
By justbeller in forum AWT / SwingReplies: 11Last Post: 07-25-2011, 10:20 AM -
Problem with JTEXTAREA
By javanew in forum New To JavaReplies: 6Last Post: 05-07-2010, 03:14 PM -
JTextArea problem
By javanew in forum AWT / SwingReplies: 2Last Post: 05-04-2010, 11:31 PM -
How can I append text in JTextArea from another class
By chikaman in forum AWT / SwingReplies: 13Last Post: 12-11-2009, 09:43 AM -
how to refresh the table when a new account is added and display instantly
By sravanthi narra in forum SWT / JFaceReplies: 4Last Post: 01-05-2008, 08:39 PM
Bookmarks