By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,798 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,798 IT Pros & Developers. It's quick & easy.

Swing Button

Shanaj
P: 51
hello

Do u Know how to change the border of a swing Button to rounded ends
Jan 13 '07 #1
Share this Question
Share on Google+
5 Replies


acoder
Expert Mod 15k+
P: 16,027
Quoted from TechInterviews
Answer: there’s 2 ways. The first thing is to know that a JButton’s edges are drawn by a Border. so you can override the Button’s paintComponent(Graphics) method and draw a circle or rounded rectangle (whatever), and turn off the border. Or you can create a custom border that draws a circle or rounded rectangle around any component and set the button’s border to it.
Jan 13 '07 #2

acoder
Expert Mod 15k+
P: 16,027
Also see this tech tip. Note however that the article is old so it may use deprecated methods - I've not checked.
Jan 13 '07 #3

Shanaj
P: 51
Quoted from TechInterviews

please reply with that code
Jan 15 '07 #4

acoder
Expert Mod 15k+
P: 16,027
please reply with that code
There was no code - it was just a tip to point you in the right direction.

Have you checked the link that I gave above?
Jan 15 '07 #5

Soujiro
P: 35
hmm.. the main of the class tells everything
Jan 16 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.