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 / March 2005

Tip: Looking for answers? Try searching our database.

Look And Feel - ButtonUI

Thread view: 
Jamie - 25 Mar 2005 17:57 GMT
Hi there,

I am new to java look and feel but have managed to do some basic stuff
myself.

I have created my own look and feel class which I change default colour etc
etc.

I am now wanting to move on and create my own ButtonUI class.  I have done
this and allowed it to extend basic buttonUI class.  At the moment I have
just got the code in there from metal look and feel and it all works fine.

I am wanting to not change myButtonUI to give my button rounded corners etc
but haven't really got much of an idea what to change etc.  Does anyone know
any good online tutorials talking through what is good to change in here or
could anyone point me in the right direction.

Thanks In Advance for you help.

Signature

Regards
Jamie
Remove YOURHEAD to reply

Cedric Lefebvre - 28 Mar 2005 19:34 GMT
I don't know if there exists good tutorials (though I have a good book on
the subject)
but the best way to learn how everything works is to look at the source code
of the look & feel classes within the JDK source code you can find on Sun's
website.
Nevertheless, if you look at this code you will find that the best way to
have round
corners is to create a RoundedBorder ;-) (i.e. you won't need to modify the
Button UI) In fact, most of the time you won't need to modify this class to
achieve what you want, the only reason to modify it would be to change its
behaviour.
Last point you should also know that the Java L&F classes are sometimes
a little bit "buggy" when deadling with special L&F due to lazys Sun's
programmers. I have pointed this problem with the Sun's Java bug parade
but have not checked yet if changes have been included within Tiger.

Hope this helps

Cedric Lefebvre
cedric.lefebvre@nospam.free.fr

> I am wanting to not change myButtonUI to give my button rounded corners etc
> but haven't really got much of an idea what to change etc.  Does anyone know
> any good online tutorials talking through what is good to change in here or
> could anyone point me in the right direction.
Jamie - 29 Mar 2005 12:40 GMT
I have had a look through the code and I don't understand how the ButtonUI
picks up the Border class.

Such as in windows look and feel there are three classes

WindowsLookAndFeel
WindowsButtonUI
WindowsBorders

I understand that in WindowsLookAndFeel it sets the UI for button to
WindowsButtonUI in the uiDefaults table.

But then I look in the WindowsButtonUI class and don't see any reference to
WindowsBorders.

What is the title of the book you have that is good?  Does it talk you
through and explain the whole look and feel well?

Thanks again

>I don't know if there exists good tutorials (though I have a good book on
> the subject)
[quoted text clipped - 28 lines]
> or
>> could anyone point me in the right direction.
John McGrath - 30 Mar 2005 01:52 GMT
> I understand that in WindowsLookAndFeel it sets the UI for button to
> WindowsButtonUI in the uiDefaults table.
>
> But then I look in the WindowsButtonUI class and don't see any reference
> to WindowsBorders.

The default border is also in the UIDefaults table.  This is initialized
in the WindowsLookAndFeel class (search for "Button.border"), and
installed in the button in the UI delegate superclass (BasicButtonUI).

Signature

Regards,

John McGrath



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.