Java look and feel tutorial

Java Swing look and feel

Before taking look at the java look and feel we need to know what exaclty is look and feel while designing graphical user interface in java swing.

1. What is look and feel?

Looks referes to the appearance of the graphical user interface widgets such as JButton or JComponent etc.
Feel referes to the how the graphical user interface widget behaves such as how the panel opens etc.

2. ComponentUI class :

As per Swing’s architecture each component is separated into two distinct classes JComponent and ComponentUI ( component UI , UI Delegate , look and feel delegate ). From the developer stand point of view developer may not need to interact with UI delegate directly. It is the responsibility of each look and feel classes to provide concrete implementation for ComponentUI subclasses.

3. Look and feel in java provided by Oracle JRE :

a. CrossPlatformLookAndFeel :
If we do nothing to set look and feel in our code, then you will see this look and feel which is also called as java look and feel or metal look and feel.

b. System Look and feel :
System look and feel is determined at run time , which is native to the look and feel of underlying operating system. Here in this case application asks the system for Look and feel.

c. Synth :

Here we can create the very own choosen Look and feel using XML file.

d. Multiplexing :

As the name suggest , in this type UI delegates multiple look and feels at same time in one application.

4. SystemLookAndFeel :

When we use SystemLookAndFeel , lets see which System Look and feels used by various system OS.

PlatForm : Solaris and Linux
Look and feel : GTK+, Motif

PlatForm : Windows XP
Look and feel : Windows XP

PlatForm : Macintosh
Look and feel : Macintosh

PlatForm : IBM Unix
Look and feel : IBM Unix

5. Look and feel packages in Java API :

This is used to while custom L&F.

This is used when we want java Look and Feel this is also called as ocean look and feel.

This package is used to configure L and F using XML files

This package as name suggest allows changing look and feel behaviour using an argument.

[caption id="attachment_922" align="alignleft" width="300" caption="metal look and feel in java"]

[caption id="attachment_923" align="alignleft" width="300" caption="motif look and feel java"]

[caption id="attachment_924" align="alignleft" width="300" caption="windows look and feel in java"]
Share on Google Plus

About Pranav

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment


Post a Comment