Re: ActionListener scoping
- From: "Jordan Greenberg" <JordanGreenberg@xxxxxxxxx>
- Date: 17 Mar 2006 11:27:57 -0800
it is highly bizarre. But if Java refuses to let you pass paramaters to
an ActionListener, or return anything, or modify local method
variables, forces me to make my little method temp. variable a class
variable, or find a much less elegant way to change that variable when
I want it's change to be based on an event in the GUI.
I don't really understand what you mean by the method not running when
the event is triggered. Essentially I have a method which creates a
JDialog, reads some input from it, disposes of the JDialog, and tosses
that data off to an object of another class entirely. As the dialog is
also local to the method, the ActionListner would never be called
outside that method. I suppose I can see how an object of one of these
classes could outlive it's parent method, but that seems like the less
common case to me, the more common case being the object dying along
with its parent method. In this case, of course, I don't see how the
fact that its a method scoped variable matters, as its still just the
parent scope for the object, just as the class scoped variables are
accessable by the method since the class scope is the method's parent
scope.
I suppose it makes more sense to me to assume that people would be
smart enough to not try and access variables in a scope that no longer
exists, rather then eliminate the possibility entirely because the
parent scope *MIGHT* no longer exist.
.
- Follow-Ups:
- Re: ActionListener scoping
- From: Oliver Wong
- Re: ActionListener scoping
- References:
- ActionListener scoping
- From: Jordan Greenberg
- Re: ActionListener scoping
- From: Roedy Green
- ActionListener scoping
- Prev by Date: Re: changing/saving a value in same variable
- Next by Date: Re: ActionListener scoping
- Previous by thread: Re: ActionListener scoping
- Next by thread: Re: ActionListener scoping
- Index(es):
Relevant Pages
|