当我使用时,我在 **windows server 2012 ** 上的进度条非常细
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
该栏在 Windows 7 中看起来不错,在 Windows Server 2012 上非常薄。
每个地方的 Java 版本都是(JDK 和 JRE)1.6.0_25,32 位
这是演示我在 jdk 1.6.0_25 上的问题(或文档问题)的完整代码
package demos;
import javax.swing.*;
import javax.swing.plaf.metal.DefaultMetalTheme;
import javax.swing.plaf.metal.MetalLookAndFeel;
import java.awt.*;
public class ProgressBarLookAndFeelDemo {
private void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("FrameDemo");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
JPanel progPanel = new JPanel();
progPanel.setLayout(new GridBagLayout());
frame.getContentPane().add(progPanel, BorderLayout.CENTER);
//
JProgressBar progressBar = new JProgressBar();
progressBar.setIndeterminate(true);
progPanel.add(progressBar);
//Display the window.
frame.pack();
frame.setVisible(true);
}
public void showUI(String name) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
if ( name.equalsIgnoreCase("system")) {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
public static void main(String[] args) throws
ClassNotFoundException, UnsupportedLookAndFeelException,
InstantiationException, IllegalAccessException {
if (args.length <1 ) {
System.out.println("usage : One argument is expected none|system");
throw new IllegalArgumentException("java classname none|system");
}
new ProgressBarLookAndFeelDemo().showUI(args[0]);
}
}
这可能是 Windows 2012 的行为,但我看不到任何与之相关的文档。