• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Get BasicArrowButton icon

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to get the icon not the actual button object that the BasicArrowButton uses.

I tried


But that is returning me null. I would like to use this same icon for another object but I have no idea how to get a hold of it.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) Create a button
2) Use the Screen Image class to get an image of the button
3) Create an ImageIcon from the Image.
 
Bobby Anderson
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tricky, Tricky. There has got to be an easier way. BasicArrowButton gets/draws that button can't I do the same?
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Billy Newman wrote:There has got to be an easier way.



Why? Do you understand how painting in Swing works? You have already stated that there is no icon for you to use. Therefore the component must use custom painting to draw the arrow.

Billy Newman wrote:BasicArrowButton gets/draws that button can't I do the same?



Sure, just copy the painting code from the BasicArrowButton paint() method.

I'll let you decide which is easier.
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Create a BufferedImage, get its Graphics2D environment, and draw on that:
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No need to paint the entire button to the BufferedImage, you can paint just the arrow using paintTriangle(...)
reply
    Bookmark Topic Watch Topic
  • New Topic