LAF : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

LAF
LAF (Look And Feel). Swing has programmable look and feel. It can be made to look like Motif, Mac etc.
Mac L&F Decorating Gotchas
Selecting Programmatically Icons Learning More
Command Line Overriding Books
Discovering Installed L&Fs Persistence Links
Discovering Active L&Fs User Selected

Mac L&F

The Mac LAF is disabled except for Mac platforms. This is restriction is fairly easy to defang so that you can test your multi-platform code, without buying Mac. Just change this method:
public boolean isSupportedLookAndFeel()
   {
   return isNativeLookAndFeel();
   }
to 
public boolean isSupportedLookAndFeel()
   {
   return true;
   }
However, if you released code that did that, the Apple lawyers would be down your neck. Even if you used the third party QuaQua L&F that more closely mimics the Mac OS (Operating System) X UI (User Interface) than Oracle’s L&F does, you would get in legal trouble if your app allowed QuaQua to run on anything but a Mac, except for development testing. If you use QuaQua, you must bundle the quaqua.jar with your application/Applet and ensure it is on the classpath.

Selecting L&F Programmatically

Note there are two techniques of setting a L&F. You can either do pass a new LookAndFeel object or the name of the LookAndFeel class as a String. The advantage of the first approach is the compiler will check that the L&F actually exists at compile time, preventing you from making a typo. The advantage of the second approach is you don’t need the L&F code present at compile time. Further, you don’t bundle any L&F code in your jar.

Using the Nimbus look & feel that comes with JDK (Java Development Kit) 1.6.0_10+, is tricky since the class file that implements it might

Selecting L&F On the Command Line

You can also set the default look and 

Discovering Installed L&Fs

Discovering Active L&Fs

// discovering the current active Look and Feel
LookAndFeel laf = UIManager.getLookAndFeel();
String lafName = laf.getName();

Decorating

You can further improve the look with: JFrame.setDefaultLookAndFeelDecorated( true );

L&F Icons

// Get an icon that looks just like the one the L&F uses
// for closing internal frames.
Icon closeIcon = UIManager.getIcon( "InternalFrame.closeIcon" );

Overriding

// overriding a colour in the L&F
UIManager.put( "TabbedPane.selected", Color.RED );
The values you can feed to UIManager.put are undocumented, but you can learn about them by studying the source code in src.zip for javax.swing.basic. BasicLookAndFeel. java.

Another approach is to write your own Look & Feel that extends some other one, and just overrides a few font-defining methods or colour-defining methods. See this sample code for a writing a derived LAF.

Persistence

If you allow the user to select his preferred L&F, you can save it using the Java persistence mechanism. Then other applications and signed Applets can automatically use that choice as the default. This won’t work for unsigned Applets. For them, you might persist the choice on the server from which the Applet was loaded. You might also cook up something with JavaScript to pass the choice as an Applet parameter. It might also be possible to persist the L&F as a cookie, stored in the browser.

User Selected

Here is some code to allow the user to pick a L&F from a list of installed L&Fs on a menu. It persists the choice using the Java Persistence mechanism. Unfortunately, this requires the Applet to be signed. When the user selects a new L&F, the code propagates the new L&F to all the Frames and Windows. It also restores the decoration the enclosing JFrame, which usually gets lost when you change L&Fs.

Gotchas

Books

book cover recommend book⇒Java Look and Feel Design Guidelines, second editionto book home
by Sun Microsystems 978-0-201-72588-9 paperback
birth 1982 age: 32
publisher Addison-Wesley
published 2001-03-19
This book contains no code. It about how to design a good UI using Metal as an example. It contains Oracle’s standards for how many pixels to use for various purposes.
Australian flag abe books anz abe books.co.uk UK flag
Chinese flag amazon.cn amazon.co.uk UK flag
German flag abe books.de abe books.ca Canadian flag
German flag amazon.de amazon.ca Canadian flag
Spanish flag amazon.es Chapters Indigo Canadian flag
Spanish flag iberlibro.com abe books.com American flag
French flag abe books.fr amazon.com American flag
French flag amazon.fr Barnes & Noble American flag
Italian flag abe books.it Google play American flag
Italian flag amazon.it O’Reilly Safari American flag
India flag junglee.com Powells American flag
UN flag Kobo other stores UN flag
Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.
book cover recommend book⇒Java Look and Feel Design Guidelines: Advanced Topicsto book home
by Sun Microsystems 978-0-201-77582-2 paperback
birth 1982 age: 32
publisher Addison-Wesley
published 2001-12-27
It is about how to design a good UI using Metal as an example.
Australian flag abe books anz abe books.co.uk UK flag
Chinese flag amazon.cn amazon.co.uk UK flag
German flag abe books.de abe books.ca Canadian flag
German flag amazon.de amazon.ca Canadian flag
Spanish flag amazon.es Chapters Indigo Canadian flag
Spanish flag iberlibro.com abe books.com American flag
French flag abe books.fr amazon.com American flag
French flag amazon.fr Barnes & Noble American flag
Italian flag abe books.it Google play American flag
Italian flag amazon.it O’Reilly Safari American flag
India flag junglee.com Powells American flag
UN flag Kobo other stores UN flag
Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.
book cover recommend book⇒GUI Bloopers 2.0: Don’ts and Do’s for Software Developers and Web Designersto book home
by Jeff Johnson 978-0-12-370643-0 paperback
publisher Morgan Kaufmann 978-0-08-055214-9 eBook
published 2007-10-12 B006L1ZUWU kindle
Works by analysing 82 examples of bad design.
Australian flag abe books anz abe books.co.uk UK flag
Chinese flag amazon.cn amazon.co.uk UK flag
German flag abe books.de abe books.ca Canadian flag
German flag amazon.de amazon.ca Canadian flag
Spanish flag amazon.es Chapters Indigo Canadian flag
Spanish flag iberlibro.com abe books.com American flag
French flag abe books.fr amazon.com American flag
French flag amazon.fr Barnes & Noble American flag
Italian flag abe books.it Google play American flag
Italian flag amazon.it O’Reilly Safari American flag
India flag junglee.com Powells American flag
UN flag Kobo other stores UN flag
Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.

Learning More

Oracle’s Javadoc on LookAndFeel class : available:
Oracle’s Javadoc on UIDefaults class : available:
Oracle’s Javadoc on UIManager class : available:
Oracle’s Java 1.8 api docs : the Multiplexing L&F : Simultaneous Multiple L&Fs : available:
Oracle’s Javadoc on javax.swing.plaf package : available:
Alloy L&F: commercial, 4 variants, glass effect
Canada Common Look and Feel
changing default Fonts
decorated
EaSynth L&F
GUI
JavooToo Look & Feel Collection
JGoodies Looks L&F
JTattoo L&F: commercial, free for freeware authors, 10 variants. One sharp looking black background
Jyloo Synthetica L&F: commercial, bland
Lipstik L&F: bold high contrast
Liquid L&F: 3D oval clear bubbles
Microsoft Vista User Experience (L&F) guide
Napkin L&F: for presenting prototype ideas, pencil scribbling
OfficeLnFs: close copy of Microsoft look
OyoAha L&F
Pgs L&F: similar to Vista, free
Quaqua L&F: like native OSOS X
skin
SkinLF: over 20 L&Fs, supports GTKGTK and KDEKDE skins
Squareness L&F: minimalist, flat, sharp rectangles
Substance L&F: with component-level scaling, and skins on top of the L&F. Precise looking
Swing
Tiny L&F: minimalist, flat
Tonic L&F: like themes used in the Windows NT days
UI-Manager probe: shows values of UI-manager properties to help you understand how it works

This page is posted
on the web at:

http://mindprod.com/jgloss/laf.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\laf.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
no blog for this page
IP:[65.110.21.43]
Your face IP:[54.204.249.184]
You are visitor number