Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2009
    Posts
    1
    Rep Power
    0

    Default getting following error org.eclipse.swt.SWTException: Invalid thread access

    Hello Everyone,
    I get the following error on trying to access a different class on click of button

    Exception in thread "main" org.eclipse.swt.SWTException: Invalid thread access

    My code goes like this:

    Calling class where main display is coded:

    Java Code:
    butt_tenant_dets.addSelectionListener(new SelectionAdapter() {
    			public void widgetSelected(SelectionEvent e) {
                TenantDets callTabObj = new TenantDets();
                callTabObj.tenant_table();
    			}
    		});
    Trying to access following code

    Java Code:
    public class TenantDets extends ProDomesticMain{
    	
    	public void tenant_table(){
    		
    		Table tenantsTable = new Table(work_space,SWT.BORDER);
    		tenantsTable.setLinesVisible(true);
    				    
    }
    }

    I learnt that following code must be used to solve the problem. But this didnt help me.
    Java Code:
    display.syncExec(
      new Runnable() {
        public void run(){
          label.setText(text);
        }
      });
    Please help.

  2. #2
    trax is offline Member
    Join Date
    Mar 2009
    Posts
    42
    Rep Power
    0

    Default

    You are getting error coz u r trying to set text on a label in a thread process , If u remove problem will be solved , try a alternate solution for setting the text on a label.

Similar Threads

  1. Replies: 3
    Last Post: 08-14-2009, 12:57 PM
  2. Replies: 2
    Last Post: 08-14-2009, 10:16 AM
  3. Invalid Thread Access?
    By xcallmejudasx in forum Advanced Java
    Replies: 1
    Last Post: 10-30-2008, 10:08 PM
  4. Invalid Argument error in IE7
    By Kaviurs in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 07-01-2008, 09:12 AM
  5. Error: invalid method declaration
    By silvia in forum New To Java
    Replies: 1
    Last Post: 07-27-2007, 12:10 PM

Posting Permissions

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