That's exactly how listeners work. Let's say you have a Button,
TextBox and a Label. Each time the Button is pressed, you want the
Label to display the text in the TextBox. You would do some like the
following:
TextBox text = new TextBox();
Label display = new Label();
Button button = new Button();
// now you need to add the listeners
button.addClickListener(new ClickListener() {
onClick(Widget arg0) {
display.setText(text.getText());
}
});
RootPanel.add(text);
RootPanel.add(display);
RootPanel.add(button);
Keep in mind that if you want the TextBox and the Label to be
accessible from the anonymous inner class, you'll need to make them
fields or final (they can't be local variables).
--
Arthur Kalmenson
On Sat, Dec 13, 2008 at 4:26 PM, jbroquefere
<[email protected]> wrote:
>
> just a little problem, i WONT have to use static method...
> I wanted to do something like, in awt/swt, when i fire an event in a
> class, and i listen to it in an other.
> Is thre a way to create listeners/event ?
>
> On 13 déc, 21:45, jbroquefere <[email protected]>
> wrote:
>> Thank's a lot, exactly what i need.
>> I just had to seek a little more
>>
>> On 13 déc, 19:47, "[email protected]" <[email protected]>
>> wrote:
>>
>> > Take a look inside the mail application that is included with GWT.
>> > It's in /samples directory. It's a great example of exactly what
>> > you're describing.
>>
>> > It's also here:
>>
>> >http://code.google.com/webtoolkit/examples/
>>
>> > Later,
>>
>> > Shaffer
>>
>> > On Dec 13, 9:46 am, jbroquefere <[email protected]>
>> > wrote:
>>
>> > > Hello,
>> > > my question is simple : How could I call an action when, for exemple,
>> > > i click on a TreeNode?
>> > > The situation is 2 class, a tree in the first one, an empty panel in
>> > > the second one. when i clik on a node, i want to open a Window, or
>> > > Panel, or Portlet, or, etc... in the empty panel (that is done by a
>> > > functio in the empty panel' class). but i dont know how to do. maybe
>> > > using event?
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---