Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » eRCP » SelectionAdapter substitute for eSWT
SelectionAdapter substitute for eSWT [message #564387] 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 #564412 is a reply to message #564387] 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:SelectionAdapter substitute for eSWT
Next Topic:Display html-text in eSWT-Label
Goto Forum:
  


Current Time: Sat Aug 30 20:27:08 EDT 2014

Powered by FUDForum. Page generated in 0.01834 seconds