Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » eRCP » SelectionAdapter substitute for eSWT
SelectionAdapter substitute for eSWT [message #518877] Fri, 05 March 2010 06:03 Go to next message
Taxiarchis.Tsaprounis is currently offline Taxiarchis.Tsaprounis
Messages: 3
Registered: March 2010
Junior Member
Hi all!

I'm trying to implement my first MIDlets in eSWT. However I find a lot of examples that contain an instance of SelectionAdapter. The question is what can I put in its place in order to get my code working in MIDP emulators?

Please provide an alternative for the following sample piece of code:

c1.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        if (c1.getText().equals("Item One")) {
          String newItems[] = { "A", "B", "C" };
          c2.setItems(newItems);
          c2.setEnabled(true);
        } else if (c1.getText().equals("Item Two")) {
          String newItems[] = { "A", "B", "C" };
          c2.setItems(newItems);
          c2.setEnabled(true);
        } else {
          c2.add("Not Applicable");
          c2.setText("Not Applicable");
        }
      }
    });


Thanks for your time!
Re: SelectionAdapter substitute for eSWT [message #535743 is a reply to message #518877] Tue, 25 May 2010 09:14 Go to previous message
Mark Rogalski is currently offline Mark Rogalski
Messages: 201
Registered: July 2009
Senior Member
A selection adapter just provides default implmentations of widgetSelected
and widgetDefaultSelected that do nothing. It saves you from having to write
"public void widgetDefaultSelected(SelectionEvent e) {}".


<Taxiarchis.Tsaprounis@certh.gr> wrote in message
news:hmqoeb$n5k$1@build.eclipse.org...
> Hi all!
>
> I'm trying to implement my first MIDlets in eSWT. However I find a lot of
> examples that contain an instance of SelectionAdapter. The question is
> what can I put in its place in order to get my code working in MIDP
> emulators?
>
> Please provide an alternative for the following sample piece of code:
>
>
> c1.addSelectionListener(new SelectionAdapter() {
> public void widgetSelected(SelectionEvent e) {
> if (c1.getText().equals("Item One")) {
> String newItems[] = { "A", "B", "C" };
> c2.setItems(newItems);
> c2.setEnabled(true);
> } else if (c1.getText().equals("Item Two")) {
> String newItems[] = { "A", "B", "C" };
> c2.setItems(newItems);
> c2.setEnabled(true);
> } else {
> c2.add("Not Applicable");
> c2.setText("Not Applicable");
> }
> }
> });
>
>
> Thanks for your time!
Previous Topic:Hardware for eRCP/eSWT demo
Next Topic:SelectionAdapter substitute for eSWT
Goto Forum:
  


Current Time: Thu Apr 24 01:25:46 EDT 2014

Powered by FUDForum. Page generated in 0.01542 seconds