• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Modify an object into a runnable

 
Paulo Carvalho
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a class with an object which contains a list of Strings. In this class I have a runnable method where I want to access this object to add an element in his list.
However, it seems that in my runnable method, the object is not modified. No error is happening.



What can I do to solve my problem?

Thanks
 
Campbell Ritchie
Sheriff
Pie
Posts: 49472
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know that method is being executed? How do you know there is no error? What is in the catch following that try? Why are you doing that on the event dispatch thread?
 
Matthew Brown
Bartender
Posts: 4567
8
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also...maybe there are bits missing that would change this interpretation, but it looks like you're asking the Runnable to be executed in another thread, but then immediately checking the size of the list. Even if the Runnable is being executed correctly, there's no reason to believe that it would have been executed by the time you check it.

(I'm assuming that line 15 should be o.getList().size() or similar)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic