awt Button with image on it
2 posts in topic
Flat View  Flat View

Posted By:   Khurram_Mahmood
Posted On:   Wednesday, May 9, 2001 01:15 AM

can some body tell me how can I put image on java.awt.Button ?

Re: awt Button with image on it

Posted By:   Virgilio_Garcia  
Posted On:   Friday, August 31, 2001 08:55 AM

Re: awt Button with image on it

Posted By:   Finlay_McWalter  
Posted On:   Tuesday, June 12, 2001 05:57 PM

You're better off coding your own component (call it ImageButton) that
shows an image (it just draws one when
paint() is called) and sends an ActionEvent when it is clicked.

You could (in theory) subclass java.awt.Button and do the draw yourself, but you'll run into severe problems drawing on regular awt components (other than containers and canvas) as AWT doesn't make guarantees that it'll tell you everytime the "native appearance" of that control changes - for example, you don't get told when a Motif button is in the depressed state, so if you try to change the appearance of a button by drawing on it, the "regular" appearance
wins on motif.

About | Sitemap | Contact