Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / September 2005

Tip: Looking for answers? Try searching our database.

custom JButton's borders (in UI update() ?)

Thread view: 
antoine - 08 Sep 2005 03:03 GMT
Hello,

I'm playing a bit with JButton aspect.
I've seen several beautiful buttons in some java L&F and am trying to
subclass only the JButton class in order to keep my original L&F but
only have SOME buttons with a different "style".

I'm basically trying to achieve the appearance of a clean 3D button
(using gradients on the sides and on the top of the button). that works
OK by modifying the "paintComponent" method.

however I'm left with the same ugly "windows style" button borders:
light gray on top and left borders, dark gray on bottom and right
borders (the ones used by the basic "windows" L&F).

I'd like to get rid of those and have a simple border (or no border at
all for that matter), but I can't find WHERE this graphic element is
set in the Java source. I've looked in JButton paintComponent, in the
ButtonUI "update" method, but I can't identify the code...

could anyone point me in the right direction ?

thanks for your help !
Michael Dunn - 08 Sep 2005 03:46 GMT
> (or no border at all for that matter)

button.setBorderPainted(false);
or
button.setBorder(null);
antoine - 08 Sep 2005 05:40 GMT
great, just had to add a this.setBorder(Metal.getButtonBorders()) in my
custom button constructor

thanks for the pointer !


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.