You can find a complete example in the Incubator project source
here<http://code.google.com/p/google-web-toolkit-incubator/source/browse/trunk/src-demo/com/google/gwt/gen2/demo/dropdownlistbox/?r=1093>
.
In brief:

1. Add this to your module definition:
<inherits name='com.google.gwt.gen2.selection.Selection' />

2. Enjoy:

DropDownListBox<String> listBox = new DropDownListBox<String>("Fruit");
// Add an item
listBox.addItem("<i>Apple</i>", "apple");
// Add an item with a tooltip
listBox.addItem("<b>Banana</b>", "banana", "A yellow fruit");


On Mon, Oct 6, 2008 at 12:03 PM, Kevin <[EMAIL PROTECTED]> wrote:

>
> Thanks again, Isaac!
>
> By the way, could you please show me where to find example code to use
> this custom widget in Incubator?
>
> Thanks,
> Kevin
>
> On Oct 6, 8:29 am, "Isaac Truett" <[EMAIL PROTECTED]> wrote:
> > Actually, no, you don't have to deploy it. Just add the jar to your
> > classpath when compiling or starting hosted mode. Also be sure to have
> your
> > module <inherit> the Incubator module that you want to use
> > (com.google.gwt.gen2.selection.Selection
> > in this case).
> >
> >
> >
> > On Sun, Oct 5, 2008 at 8:55 PM, Kevin <[EMAIL PROTECTED]>
> wrote:
> >
> > > Hi Isaac,
> >
> > > Thanks for the tip.
> >
> > > I'm guessing that I just download the JAR for this type of ListBox,
> > > then deploy it to my WEB-INF/lib folder when deploying?
> >
> > > On Oct 2, 7:51 am, "Isaac Truett" <[EMAIL PROTECTED]> wrote:
> > > > Kevin,
> >
> > > > There's a DropDownListBox widget in the Incubator that might be more
> > > > in line with what you're trying to achieve here. It uses a PushButton
> > > > and a PopupPanel to simulate the behavior of a standard <select>
> > > > element. The use of widgets gives you a lot more control over
> > > > appearance and function.
> >
> > > > - Isaac
> >
> > > > On Wed, Oct 1, 2008 at 3:58 PM, Kevin <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > > Hi,
> >
> > > > > I hope your day's going well.
> >
> > > > > In my GWT client code, I have a ListBox that has text representing
> > > > > cars. If you pick "Sedan," it should bring up a picture of a sedan.
> If
> > > > > you select "SUV," it should bring up a picture of an SUV.
> >
> > > > > I know that you can't add images as inputs to a GWT ListBox,
> however I
> > > > > know that you can add background-images in a CSS.
> >
> > >
> <--------------------------------------------------------------------------­­-----
> >
> > > > > Consider my "client code":
> >
> > > > > ListBox lb = new ListBox(); // you need to instantiate a ListBox so
> > > > > you can use it
> >
> > > > > lb.addItem("Sedan"); // you need to populate
> > > > > lb.addItem("SUV");   // the ListBox options
> >
> > > > > if ( item.selected == 0 )
> > > > >    lb.setStyleName("sedan");
> > > > > else
> > > > >    lb.setStyleName("SUV");
> >
> > >
> <--------------------------------------------------------------------------­­-----
> >
> > >
> <--------------------------------------------------------------------------­­-----
> >
> > > > > Now look at my "HTML code"
> >
> > > > > <style type = "text/css">
> >
> > > > > .Sedan { background-image: URL(.../images/Sedan.jpg) }
> > > > > .SUV{ background-image: URL(.../images/SUV.jpg) }
> >
> > > > > </style>
> >
> > >
> <--------------------------------------------------------------------------­­-----
> >
> > > > > After, when I select a ListBox option, only text appears - no
> image.
> >
> > > > > My ultimate goal is to have a ListBox with images that when you
> select
> > > > > one, its picture becomes the selected, i.e. only visible, image.
> >
> > > > > Thanks,
> > > > > Kevin- Hide quoted text -
> >
> > > > - Show quoted text -- Hide quoted text -
> >
> > - Show quoted text -
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to