在Java程序的标题栏中显示日语字符 [英] Showing Japanese Characters in TItle Bar of Java Program
问题描述
除了Java中主窗口(JFrame)的标题栏外,我都能在任何地方显示日语字符.有没有办法更改此标题栏的字体,使其可以显示日语字符?谢谢
I am able to display Japanese characters everywhere except for the title bar of the main window (JFrame) in Java. Is there a way to change the font of this title bar so it can display japanese characters? Thanks
我正在使用Windows XP.如果这很重要,那么我也在使用Java Substance外观.
I am using Windows XP. If this matters I am using the Java Substance look and feel too.
推荐答案
窗口的标题栏由系统窗口管理器而不是Swing管理.您没有说您正在使用什么OS/GUI.
A window's title bar is managed by the system window manager, not by Swing. You don't say what OS/GUI you're using.
对于Windows XP,打开显示控制面板,选择外观"选项卡,然后单击高级"按钮;您可以在此处更改标题字体(尽管系统上安装的字体可能没有所需的字形).
For Windows XP, open the Display control panel, select the "Appearance" tab, and click the "Advanced" button; you can change the title font there (although the fonts installed on your system may not have the glyphs you need).
下面是一些代码,用于检查系统默认字体是否支持所需的字形(我不知道字符是什么;这是片假名集中的漂亮字形):
Here's some code that checks whether the system default font supports the glyph that you want (I have no idea what the character is; it's a nice-looking glyph from the Katakana set):
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
public class GlyphCheck
{
public static void main(String[] argv) throws Exception {
final String title = "Testing: \u30CD";
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame(title);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JLabel label = new JLabel(title);
label.setSize(200, 100);
frame.setContentPane(label);
frame.pack();
frame.setVisible(true);
}
});
}
}
这篇关于在Java程序的标题栏中显示日语字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!