Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing Japanese Characters in TItle Bar of Java Program

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

I am using Windows XP. If this matters I am using the Java Substance look and feel too.

like image 711
baseballtank13 Avatar asked Nov 17 '25 02:11

baseballtank13


1 Answers

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.

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);
            }
        });
    }
}
like image 122
kdgregory Avatar answered Nov 19 '25 16:11

kdgregory



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!