你说的是不是java的look and feel
如果是,java的look and feel指的是awt或swing的显示风格,有三种:跨平台的统一的风格,特定操作系统的风格,用户自定义的风格thinking in java中的一个例子
LookAndFeel.javaimport javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import com.bruceeckel.swing.*;
public class LookAndFeel extends JFrame {
String[] choices = { "eeny", "meeny", "minie", "moe", "toe", "you" }; Component[] samples = {
new JButton("JButton"), new JTextField("JTextField"),
new JLabel("JLabel"), new JCheckBox("JCheckBox"),
new JRadioButton("Radio"), new JComboBox(choices),
new JList(choices),
}; public LookAndFeel() {
super("Look And Feel");
Container cp = getContentPane();
cp.setLayout(new FlowLayout());
for (int i = 0; i < samples.length; i++) {
cp.add(samples[i]);
}
} private static void usageError() {
System.out.println("Usage : LookAndFeel [ cross | system | motif ]");
System.exit(1);
} public static void main(String[] args) {
if (args.length == 0) {
usageError();
}
if (args[0].equals("cross")) {
try {
UIManager.setLookAndFeel(
UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace(System.err);
}
} else if (args[0].equals("system")) {
try {
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace(System.err);
}
} else if (args[0].equals("motif")) {
try {
UIManager.setLookAndFeel("com.sun.java." +
"swing.plaf.motif.MotifLookAndFeel");
} catch (Exception e) {
e.printStackTrace(System.err);
}
} else {
usageError();
} Console.run(new LookAndFeel(), 300, 200);
}
}
如果是,java的look and feel指的是awt或swing的显示风格,有三种:跨平台的统一的风格,特定操作系统的风格,用户自定义的风格thinking in java中的一个例子
LookAndFeel.javaimport javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import com.bruceeckel.swing.*;
public class LookAndFeel extends JFrame {
String[] choices = { "eeny", "meeny", "minie", "moe", "toe", "you" }; Component[] samples = {
new JButton("JButton"), new JTextField("JTextField"),
new JLabel("JLabel"), new JCheckBox("JCheckBox"),
new JRadioButton("Radio"), new JComboBox(choices),
new JList(choices),
}; public LookAndFeel() {
super("Look And Feel");
Container cp = getContentPane();
cp.setLayout(new FlowLayout());
for (int i = 0; i < samples.length; i++) {
cp.add(samples[i]);
}
} private static void usageError() {
System.out.println("Usage : LookAndFeel [ cross | system | motif ]");
System.exit(1);
} public static void main(String[] args) {
if (args.length == 0) {
usageError();
}
if (args[0].equals("cross")) {
try {
UIManager.setLookAndFeel(
UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace(System.err);
}
} else if (args[0].equals("system")) {
try {
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace(System.err);
}
} else if (args[0].equals("motif")) {
try {
UIManager.setLookAndFeel("com.sun.java." +
"swing.plaf.motif.MotifLookAndFeel");
} catch (Exception e) {
e.printStackTrace(System.err);
}
} else {
usageError();
} Console.run(new LookAndFeel(), 300, 200);
}
}
com/bruceeckel/swing/Console.java
// Tool for running Swing demos from the
// console, both applets and JFrames.
package com.bruceeckel.swing;
import javax.swing.*;
import java.awt.event.*;
public class Console {
// Create a title string from the class name :
public static String title(Object o) {
String t = o.getClass().toString(); // Remove the word "class" :
if (t.indexOf("class") != -1) {
t = t.substring(6);
}
return t;
} public static void setupClosing(JFrame frame) {
// The JDK 1.2 Solution as an
// anonymous inner class : frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}); // The improved solution in JDK 1.3 :
// frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void run(JFrame frame, int width, int height) {
setupClosing(frame);
frame.setSize(width, height);
frame.setVisible(true);
} public static void run(JApplet applet, int width, int height) {
JFrame frame = new JFrame(title(applet));
setupClosing(frame);
frame.getContentPane().add(applet);
frame.setSize(width, height);
applet.init();
applet.start();
frame.setVisible(true);
} public static void run(JPanel panel, int width, int height) {
JFrame frame = new JFrame(title(panel));
setupClosing(frame);
frame.getContentPane().add(panel);
frame.setSize(width, height);
frame.setVisible(true);
}
}