• Post Reply Bookmark Topic Watch Topic
  • New Topic

IS IT POSSIBLE TO HAVE AN ICON A ON AWT BUTTON LIKE JBUTTON

 
syed baber
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any way of having an icon(gif file) on awt button as it is in Swing's Jbutton.please if there is any way give the sourcecode for this.thankyou
 
Jonathan W. Brett
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, can only be done in Swing as far as I know.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Windows doesn't support icons on buttons. Since AWT uses the native windows peer to draw the button, there is no way to do this.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Syed,
Here is a link to something that may help you... Code I wrote for an ImageButton is provided in this discussion... It is not exactly like the behavior you describe, since it shows the Image as the button, but you could easily modify it for your purposes.
HTH,
-Nate
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!