What does look and feel (java swing) mean?
Actually what is开发者_如何学JAVA meant by look and feel?
It means how the Graphical User Interface (GUI) looks like and behaves. Every OS has its own typical Look&Feel.
At the beginning, Java had its own, but of course most people want to have their applications look like the others of their OS.
You can change the L&F of your Java applications, read about it in the tutorials.
Read about L&F in general at Wikipedia.
To directly quote the Sun tutorials:
"Look" refers to the appearance of GUI widgets (more formally, JComponents) and "feel" refers to the way the widgets behave.
This is how your application looks like. Read here.
Others have said it is a way to change the way your program looks and feel.
To demonstrate, go to http://java.sun.com/javase/technologies/desktop/javawebstart/demos-nojavascript.html and launch "The SwingSet Demo" (requires Java installed).
In the menu under "Look & Feel" several options exist that allows you to choose between different Look and Feels included with the default Java installation.
You can also bring your own if you want to. See http://www.jgoodies.com/freeware/metamorphosis/index.html for a demonstration about how to tweak your Look and Feel. You can launch the demo directly from http://www.jgoodies.com/download/demos/metamorphosis/metamorphosis.jnlp
Swing is GUI Widget Toolkit for Java. It is an API for providing Graphical User Interface to Java Programs. Unlike AWT, Swing components are written in Java and therefore are platform-independent. Swing provides platform specific Look and Feel and also an option for pluggable Look and Feel, allowing application to have Look and Feel independent of underlying platform.
Initially there were very few options for colors and other settings in Java Swing, that made the entire application look boring and monotonous. With the growth in Java framework, new changes were introduced to make the UI better and thus giving developer opportunity to enhance the look of a Java Swing Application.
“Look” refers to the appearance of GUI widgets and “feel” refers to the way the widgets behave. Sun’s JRE provides the following L&Fs:
CrossPlatformLookAndFeel: this is the “Java L&F” also known as “Metal” that looks the same on all platforms. It is part of the Java API (javax.swing.plaf.metal) and is the default. SystemLookAndFeel: here, the application uses the L&F that is default to the system it is running on. The System L&F is determined at runtime, where the application asks the system to return the name of the appropriate L&F. For Linux and Solaris, the System L&Fs are “GTK+” if GTK+ 2.2 or later is installed, “Motif” otherwise. For Windows, the System L&F is “Windows”. Synth: the basis for creating your own look and feel with an XML file. Multiplexing: a way to have the UI methods delegate to a number of different look and feel implementations at the same time.
精彩评论