Results 1 to 3 of 3
  1. #1
    int80 is offline Member
    Join Date
    Jul 2008
    Posts
    29
    Rep Power
    0

    Default org.eclipse.swt.SWTException: Invalid thread access

    I've got three classes, two have methods in them. Class one renders widgets and shell for a login screen and the method returns a three element array. Class two has a method in it that is called after Class ones' method has return the array.

    And it looks like this:

    Java Code:
      public static void main(String args[]) {
    	
    	String[] loginDetails = new String[3]; //create array
    	
    	LoginWidgets login = new LoginWidgets(); //create object
            DetailsScreen details1 = new DetailsScreen();// ''
    	
    	
    	loginDetails = login.RenderWidgets(); //Get username/password/database returned by method in first class
    	details1.DetailsScreenRender(); //call method in second class

    It's just, when I run this, it comes up with this error:

    Java Code:
    Exception in thread "main" org.eclipse.swt.SWTException: Invalid thread access
    	at org.eclipse.swt.SWT.error(Unknown Source)
    	at org.eclipse.swt.SWT.error(Unknown Source)
    	at org.eclipse.swt.SWT.error(Unknown Source)
    	at org.eclipse.swt.widgets.Display.checkDisplay(Unknown Source)
    	at org.eclipse.swt.widgets.Display.create(Unknown Source)
    	at org.eclipse.swt.graphics.Device.<init>(Unknown Source)
    	at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
    	at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
    	at Practise.LoginWidgets.<init>(LoginWidgets.java:11)
    	at Practise.Simian.main(Simian.java:17)
    And it says the problem is with this line:

    DetailsScreen details1 = new DetailsScreen();


    I'm really not sure what's going on. Thanks in advance for anyone that knows what's going on!!

  2. #2
    Jaanavee is offline Member
    Join Date
    Jul 2009
    Posts
    1
    Rep Power
    0

    Default

    I have same problem... I have class in some package and I am accessing it in another class that time it shows this error.....

    Exception in thread "main" org.eclipse.swt.SWTException: Invalid thread access
    at org.eclipse.swt.SWT.error(Unknown Source)
    at org.eclipse.swt.SWT.error(Unknown Source)
    at org.eclipse.swt.SWT.error(Unknown Source)
    at org.eclipse.swt.widgets.Display.checkDisplay(Unkno wn Source)
    at org.eclipse.swt.widgets.Display.create(Unknown Source)
    at org.eclipse.swt.graphics.Device.<init>(Unknown Source)
    at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
    at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
    at internalframes.ScrollableTable.<init>(ScrollableTa ble.java:31)
    at MainFrame.createFrame(MainFrame.java:184)
    at MainFrame$4.handleEvent(MainFrame.java:77)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unkno wn Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Control.WM_MENUSELECT(Unkn own Source)
    at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
    at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
    at org.eclipse.swt.widgets.Decorations.windowProc(Unk nown Source)
    at org.eclipse.swt.widgets.Shell.windowProc(Unknown Source)
    at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(N ative Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(Un known Source)
    at org.eclipse.swt.widgets.Shell.callWindowProc(Unkno wn Source)
    at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
    at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
    at org.eclipse.swt.widgets.Decorations.windowProc(Unk nown Source)
    at org.eclipse.swt.widgets.Shell.windowProc(Unknown Source)
    at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
    at org.eclipse.swt.internal.win32.OS.DefWindowProcW(N ative Method)
    at org.eclipse.swt.internal.win32.OS.DefWindowProc(Un known Source)
    at org.eclipse.swt.widgets.Shell.callWindowProc(Unkno wn Source)
    at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
    at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
    at org.eclipse.swt.widgets.Decorations.windowProc(Unk nown Source)
    at org.eclipse.swt.widgets.Shell.windowProc(Unknown Source)
    at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
    at org.eclipse.swt.internal.win32.OS.DispatchMessageW (Native Method)
    at org.eclipse.swt.internal.win32.OS.DispatchMessage( Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Un known Source)
    at MainFrame.<init>(MainFrame.java:163)
    at MainFrame.main(MainFrame.java:16)

    Please help.....Thanks in advance.....

  3. #3
    dswastik is offline Senior Member
    Join Date
    Dec 2008
    Location
    Kolkata
    Posts
    282
    Rep Power
    6

Similar Threads

  1. data from the main/GUI thread to another runnin thread...
    By cornercuttin in forum Threads and Synchronization
    Replies: 2
    Last Post: 04-23-2008, 10:30 PM
  2. Replies: 0
    Last Post: 01-28-2008, 07:02 AM
  3. Replies: 1
    Last Post: 08-07-2007, 07:51 AM
  4. how to access to an object from a thread
    By tamayo in forum New To Java
    Replies: 1
    Last Post: 07-24-2007, 04:24 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
  •