Have you tried the 'PushButton' class?

http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/PushButton.html

The constructor takes a single image, or a pair of images for up/down.

Jamie.


On May 22, 9:46 am, abhiram wuntakal <[email protected]> wrote:
> Hi Donald,
>
>   Thanks for your reply, but i am sorry, i guess u have misunderstood my
> problem. My problem is...
>
>   I have 3 buttons Button1, Button2 and Button3. All three have different
> functionalities. So I have a different image to be displayed on each of the
> buttons. If i use CSS then i need to have a different style for each of the
> buttons. But all the buttons look similar except for the image that gets on
> top of the button.
>
>  My doubt is, is there a way to have the image displayed on the Button by
> setting the image directly from the Code (Not from the css), so that when i
> define the button i have the image defined for it as well.
>
>  Hope my doubt is much clear now. Please let me know if you can suggest any
> solution for this problem.
> Best Regards,
> Abhiram
>
> On Fri, May 22, 2009 at 7:07 PM, Donald.W.Long <
>
> [email protected]> wrote:
>
> > If I understand you correctly you just wish to control each button in
> > your application.
>
> > If you wish to replace the complete default style that is used for
> > button then use the following
>
> >    button.setStyleName("mystyle");
>
> > CSS file would be
>
> > .mystyle {
> >  <place your styles here>
> > }
>
> > Create a style for each button and you are done.  By doing this it
> > allows you to change the program look without changing the code.
>
> > You can also use the CSS cascading ability by appending a style to
> > your button, I have found issues in this area from time to time, but
> > works most of the time.
>
> >    button.addStyleName("myextstyle");
>
> > CSS
>
> > .myextsyle {
> >  <add your styles>
> > }
>
> > From what I understand this should still use the normal style and add
> > this to the list.  I have not used this
>
> > or you can
>
> >            button.addStyleDependentName("myextstyle")'
>
> > .gwt-Button-myextsyle {
> >  <add you styles>
> > }
>
> > I hope I got the above correct if not some else please show the
> > correct method.
>
> > Hope this helps Donald W. Long
>
> > On May 22, 3:32 am, abhiram <[email protected]> wrote:
> > > Hi,
>
> > >   I wanted to know the procedure to add images to PushButtons.
> > >   I have found a css style by which i can add it. But that would mean
> > > that for every button with an image, i need to write a style rather
> > > than having a single style. Is there any way to specify the image for
> > > the face of the push button from the code itself?
>
> > > regards,
> > > Abhiram
--~--~---------~--~----~------------~-------~--~----~
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