标题栏出现中文乱码,无论是窗体 还是对话框都这样
下面是源代码 采用substance5.2
package DragonFrame;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.FontUIResource;import org.jvnet.substance.skin.SubstanceMistAquaLookAndFeel;
import org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel;
import org.jvnet.substance.skin.SubstanceOfficeSilver2007LookAndFeel;public class Walkthrough extends JFrame {
public Walkthrough() {
super("window窗口乱码");
this.setLayout(new FlowLayout());
this.add(new JButton("button按钮"));
this.add(new JCheckBox("check选择"));
this.add(new JLabel("label标签"));
this.setUndecorated(true);
getRootPane().setWindowDecorationStyle(JRootPane.FRAME); this.setSize(new Dimension(300, 80));
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} public static void main(String[] args) {
Font font = new Font("Dialog",Font.LAYOUT_NO_LIMIT_CONTEXT,14);
UIManager.put("ToolTip.font",font);
UIManager.put("Table.font",font);
UIManager.put("TableHeader.font",font);
UIManager.put("TextField.font",font);
UIManager.put("ComboBox.font",font);
UIManager.put("TextField.font",font);
UIManager.put("PasswordField.font",font);
UIManager.put("TextArea.font",font);
UIManager.put("TextPane.font",font);
UIManager.put("EditorPane.font",font);
UIManager.put("FormattedTextField.font",font);
UIManager.put("Button.font",font);
UIManager.put("CheckBox.font",font);
UIManager.put("RadioButton.font",font);
UIManager.put("ToggleButton.font",font);
UIManager.put("ProgressBar.font",font);
UIManager.put("DesktopIcon.font",font);
UIManager.put("TitledBorder.font",font);
UIManager.put("Label.font",font);
UIManager.put("List.font",font);
UIManager.put("TabbedPane.font",font);
UIManager.put("MenuBar.font",font);
UIManager.put("Menu.font",font);
UIManager.put("MenuItem.font",font);
UIManager.put("PopupMenu.font",font);
UIManager.put("CheckBoxMenuItem.font",font);
UIManager.put("RadioButtonMenuItem.font",font);
UIManager.put("Spinner.font",font);
UIManager.put("Tree.font",font);
UIManager.put("ToolBar.font",font);
UIManager.put("OptionPane.messageFont",font);
UIManager.put("OptionPane.buttonFont",font);
UIManager.put("InternalFrame.titleFont",new Font("宋体",Font.BOLD,13));
JFrame.setDefaultLookAndFeelDecorated(true);
try {
UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel");
// UIManager.setLookAndFeel(new SubstanceOfficeBlue2007LookAndFeel()) ;
} catch (Exception e) {
System.out.println("Substance Raven Graphite failed to initialize");
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Walkthrough w = new Walkthrough();
w.setVisible(true);
}
});
}}
下面是源代码 采用substance5.2
package DragonFrame;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.FontUIResource;import org.jvnet.substance.skin.SubstanceMistAquaLookAndFeel;
import org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel;
import org.jvnet.substance.skin.SubstanceOfficeSilver2007LookAndFeel;public class Walkthrough extends JFrame {
public Walkthrough() {
super("window窗口乱码");
this.setLayout(new FlowLayout());
this.add(new JButton("button按钮"));
this.add(new JCheckBox("check选择"));
this.add(new JLabel("label标签"));
this.setUndecorated(true);
getRootPane().setWindowDecorationStyle(JRootPane.FRAME); this.setSize(new Dimension(300, 80));
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} public static void main(String[] args) {
Font font = new Font("Dialog",Font.LAYOUT_NO_LIMIT_CONTEXT,14);
UIManager.put("ToolTip.font",font);
UIManager.put("Table.font",font);
UIManager.put("TableHeader.font",font);
UIManager.put("TextField.font",font);
UIManager.put("ComboBox.font",font);
UIManager.put("TextField.font",font);
UIManager.put("PasswordField.font",font);
UIManager.put("TextArea.font",font);
UIManager.put("TextPane.font",font);
UIManager.put("EditorPane.font",font);
UIManager.put("FormattedTextField.font",font);
UIManager.put("Button.font",font);
UIManager.put("CheckBox.font",font);
UIManager.put("RadioButton.font",font);
UIManager.put("ToggleButton.font",font);
UIManager.put("ProgressBar.font",font);
UIManager.put("DesktopIcon.font",font);
UIManager.put("TitledBorder.font",font);
UIManager.put("Label.font",font);
UIManager.put("List.font",font);
UIManager.put("TabbedPane.font",font);
UIManager.put("MenuBar.font",font);
UIManager.put("Menu.font",font);
UIManager.put("MenuItem.font",font);
UIManager.put("PopupMenu.font",font);
UIManager.put("CheckBoxMenuItem.font",font);
UIManager.put("RadioButtonMenuItem.font",font);
UIManager.put("Spinner.font",font);
UIManager.put("Tree.font",font);
UIManager.put("ToolBar.font",font);
UIManager.put("OptionPane.messageFont",font);
UIManager.put("OptionPane.buttonFont",font);
UIManager.put("InternalFrame.titleFont",new Font("宋体",Font.BOLD,13));
JFrame.setDefaultLookAndFeelDecorated(true);
try {
UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel");
// UIManager.setLookAndFeel(new SubstanceOfficeBlue2007LookAndFeel()) ;
} catch (Exception e) {
System.out.println("Substance Raven Graphite failed to initialize");
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Walkthrough w = new Walkthrough();
w.setVisible(true);
}
});
}}
# (logive)
#
# 等 级:
# 结帖率:0.00%你的结贴率也太低了。右击你的文本编辑看是什么编码?
这个方法对我管用,不知道你是不是也管用
我怀疑是substance5.2的版本问题 ,
对了顺便问下我使用substance6.1的SubstanceOfficeBlue2007LookAndFeel()总是出现异常信息 不知道是方法不对还是怎么的
Exception in thread "main" java.lang.NoClassDefFoundError: org/pushingpixels/trident/ease/TimelineEase
at org.pushingpixels.lafwidget.animation.AnimationFacet.<init>(AnimationFacet.java:54)
at org.pushingpixels.lafwidget.animation.AnimationFacet.<clinit>(AnimationFacet.java:61)
at org.pushingpixels.substance.api.SubstanceLookAndFeel.<clinit>(SubstanceLookAndFeel.java:153)
at mianstart.MainStart.main(MainStart.java:77)
Caused by: java.lang.ClassNotFoundException: org.pushingpixels.trident.ease.TimelineEase
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more
http://kenai.com/projects/trident/downloads
报这样的错一般是缺少JAR包
但是加载了Substance6.1的SubstanceOfficeBlue2007LookAndFeel()后抛出了异常Substance Raven Graphite failed to initialize
下面是加载方法 请帮忙看看有什么问题没有
try {
UIManager.setLookAndFeel(new SubstanceOfficeBlue2007LookAndFeel());
} catch (Exception e) {
System.out.println("Substance Raven Graphite failed to initialize");
}