标题栏中文乱码,请高手帮忙解决

logive 2010-04-20 05:31:09
标题栏出现中文乱码,无论是窗体 还是对话框都这样
下面是源代码 采用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);
}

});
}

}


...全文
524 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
luomf 2010-04-29
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 huntor 的回复:]
需要trident.jar
http://kenai.com/projects/trident/downloads
[/Quote]

报这样的错一般是缺少JAR包
jacky花园 2010-04-29
  • 打赏
  • 举报
回复
经验证
非乱码
huntor 2010-04-29
  • 打赏
  • 举报
回复
logive 2010-04-29
  • 打赏
  • 举报
回复
怎么解决呀
秋9 2010-04-29
  • 打赏
  • 举报
回复
没有发现org/pushingpixels/trident/ease/TimelineEase
logive 2010-04-29
  • 打赏
  • 举报
回复
谢谢各位了 这些方法对substance5.2 的OfficeBlue2007Skin()还是无效 其他版本没有这个问题
我怀疑是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
logive 2010-04-29
  • 打赏
  • 举报
回复
出现这个异常 就是你的lookAndFeel没有加载成功啊
huntor 2010-04-29
  • 打赏
  • 举报
回复
没遇到乱码。只是看到了“Substance Raven Graphite failed to initialize”
bb_bb_pig 2010-04-29
  • 打赏
  • 举报
回复
http://txf2004.javaeye.com/blog/498754
这个方法对我管用,不知道你是不是也管用
logive 2010-04-29
  • 打赏
  • 举报
回复
下载安装了trident.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");
}
bb_bb_pig 2010-04-29
  • 打赏
  • 举报
回复
我用了 substance 中文也成了乱码,不用就是好的呀
logive 2010-04-21
  • 打赏
  • 举报
回复
顺便说下 俺是新手 刚入道的 请多多指教啊
logive 2010-04-21
  • 打赏
  • 举报
回复
不行啊 用UTF-8也是一堆乱码啊其他的更不行
luomf 2010-04-21
  • 打赏
  • 举报
回复
对,调整一下字符码试试,若不行再说~
SambaGao 2010-04-21
  • 打赏
  • 举报
回复
# logive
# (logive)
#
# 等 级:
# 结帖率:0.00%

你的结贴率也太低了。

右击你的文本编辑看是什么编码?
欢乐极客 2010-04-20
  • 打赏
  • 举报
回复
将你的项目编码方式设置为UTF-8试试

62,612

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧