Skip to main content


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 11:03 Go to next message
Taxiarchis.Tsaprounis is currently offline Taxiarchis.TsaprounisFriend
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 13:14 Go to previous message
Mark Rogalski is currently offline Mark RogalskiFriend
Messages: 200
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: Sun Dec 01 21:03:22 GMT 2024

Powered by FUDForum. Page generated in 0.02942 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top