• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Round Buttons in Java

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All ,
For my java based application I need round buttons .. Can anyone help me out and give me sugesstions on how to customise JButton to make it round ...as displayed in Visual Age for Java
Thanks in Advance ...
bhuvan
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A quick and relatively easy solution might be to create a round image with the look you want for the button then create a JButton and an ImageIcon ( using the previously created image ).
Then
button.setIcon(imageIcon); //set the button to use the image
button.setBorderPainted(false); //so you don't see the edges of the button
Of course the drawback is that the background of image must match the background of the component you add the button to.
I suppose there are other ways such as extending the JButton class but off the top of my head, I'm afraid I couldn't be much help in that approach.
Hope this was some help.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a tech tips about this on http://java.sun.com/
http://developer.java.sun.com/developer/TechTips/1999/tt0826.html
 
bhuvan gupta
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Scott and timothy
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic