Results 1 to 3 of 3
  1. #1
    niba10 is offline Member
    Join Date
    Feb 2011
    Posts
    30
    Rep Power
    0

    Default problem making a gui

    Hi I use netbeans IDE to build my multithreaded server .
    so I built some gui with two buttons Start and Stop and a label called Status(online/offline)
    the two buttons have action listeners and in the start button action listener
    I put the code below to start the server I run the application and I press start button
    and it start the server but the gui server (the jframe stop response) here is the code to start the server :

    Java Code:
    
        	int port_number=2222;
        	
        	
        	
    
                try {
        	    serverSocket = new ServerSocket(port_number);
        	    System.out.println ("SpeedChat Server Is Online!!!");
                }
                catch (IOException e)
        	    {System.out.println(e);}
        	
        	
        	while(true){
        	    try {
        		clientSocket = serverSocket.accept();
        		for(int i=0; i<=9; i++){
        		    if(t[i]==null)
        			{
        			    (t[i] = new clientThread(clientSocket,t,"100","",i,clientSocket.getInetAddress().getHostAddress())).start();
        			    break;
        			}
        		}
        	    }
        	    catch (IOException e) {
        		System.out.println(e);}
        	}
    why this happen and how I fix this ??
    Last edited by niba10; 04-04-2011 at 02:35 AM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Read this: Concurrency in Swing.

    It will tell you what your problem is (a frozen Event Dispatch Thread) and how to solve it with a SwingWorker object.

  3. #3
    niba10 is offline Member
    Join Date
    Feb 2011
    Posts
    30
    Rep Power
    0

Similar Threads

  1. making an exe from .jar
    By ron2794 in forum NetBeans
    Replies: 3
    Last Post: 02-04-2011, 08:28 AM
  2. Facing problem in making connection to mail server
    By Basit56 in forum New To Java
    Replies: 2
    Last Post: 01-22-2010, 06:27 PM
  3. Need help making .jar
    By yoodidoo in forum Eclipse
    Replies: 4
    Last Post: 08-03-2009, 08:57 PM
  4. Replies: 3
    Last Post: 07-15-2009, 06:10 AM
  5. Problem with making/sorting a deck of cards
    By Franneldort in forum New To Java
    Replies: 9
    Last Post: 11-07-2008, 12:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •