If "all those various textboxes" are in the same class then you just
have to make them PRIVATE - not global. If they are in other Classes
then you have to make them PUBLIC(bad style) or provide a bunch of
public GET/SET Methods(good style). Another way is to declare them
("all those various textboxes") BEFORE you've declared your button
(like gregore showed you).
On 18 Nov., 12:28, gregor <[EMAIL PROTECTED]> wrote:
> public class MyComponent {
> private SimplePanel panel = new SimplePanel();
> private textBox = new TextBox();
> private Button myButton = new Button("Save",
> new ClickListener() {
> public void onClick(Widget sender) {
> String data = textBox.getText()
> }
> });
>
> public MyComponent {
> panel.add(textBox);
> panel.add(myButton);
>
> }
>
> Instance variables declared in MyComponent are directly available like
> this. if panel was a separate class then you would need to do
> something like:
>
> panel.getTextBox().gettext();
>
> regards
> gregor
>
> On Nov 18, 4:29 am, Loki <[EMAIL PROTECTED]> wrote:
>
> > Perhaps my brain is just fried-- the longer I code, the less sense
> > coding seems to make to me, so maybe I just need a break, but I'll
> > list my problem just in case I'm wrong.
>
> > Okay, so I have a setup where a user enters data into a bunch of
> > various textboxes, and there's a button labeled "Save" waiting for the
> > user at the end of it all. However, with the way the button is set
> > up--
>
> > Button save = new Button("Save",
> > new ClickListener() {
> > public void onClick(Widget sender) {
>
> > }
> > });
>
> > And then later,
>
> > panel.add(save);
>
> > it seems to me that I can't really put anything in the onClick()
> > method that will actually allow me to access all those various
> > textboxes I have elsewhere without making, like, EVERY textbox a
> > global variable, which is just nonsense.
>
> > SUMMARY: wut do i do guyz
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---