> >> I have develop an application, but I am having som problems what
> >> eventshandling when a MenuItem in a Frame is pressed.
[quoted text clipped - 9 lines]
> >>
> >> The update-objekt i an class implementes Runnable.
1. Can you check your keyboard? It looks to me that in the paragraph
above, we have (among other things that do not facilitate
understanding) several times a simple "i" when an "is" would be more
appropriate IMHO.
2. Without some code, it is very difficult to give you any more
detailed hint. But from what I think I have understood so far, you
have a class that is both an ActionListener and a ThreadStarter (so to
speak) which has an instance of itself as static member. This "static
instance" is basically a thread. You want to separate the
actionListening from the threadStarting functionality.
> But the problem is that i the main-Frame klasse where i add the
> actionListener i write:
[quoted text clipped - 3 lines]
> This means that the Update-object is create when the main-Frame is
> initialized - and not when the button with the text "Update" is pressed.
What means "Update" object? Are you talking about your instance of
"Update" that is usd as an actionListener or do you mean the "static
instance" (i. e. the thread that is apparently to be started when the
button is pressed)?
In general, I can see two possible solutions:
a) Shift the generation of your "static instance"-thread to the
actionPerformed-method. I believe that is what you could be called
"generate the Update-object when the button is pressed."
b) Rename your ActionListener from "Update" to "UpdateCreator" and
shift your threadStarting logic to a new class called "Update". Create
a new instance of "Update" in the actionPerformed-method of
"UpdateCreator". Maybe that solves your problem.
HTH, Piet