SelectionAdapter substitute for eSWT [message #564387] |
Fri, 05 March 2010 11:03  |
Eclipse User |
|
|
|
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 13:14  |
Eclipse User |
|
|
|
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!
|
|
|
Powered by
FUDForum. Page generated in 0.02405 seconds