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 #564387] 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 #564412 is a reply to message #564387] Tue, 25 May 2010 13:14 Go to previous message
Mark Rogalski is currently offline Mark RogalskiFriend
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 Apr 20 04:29:11 GMT 2024

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

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

Back to the top