Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6636123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:08:44+00:00 2026-05-25T23:08:44+00:00

The native Windows LookAndFeel in Java 6 seems to incorrectly size some fonts. Test

  • 0

The native Windows LookAndFeel in Java 6 seems to incorrectly size some fonts.

Test program:

import java.awt.*;
import java.awt.event.KeyEvent;
import javax.swing.*;

public class Test {
  public static void main(String[] arg) throws Exception {
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        try {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
        catch (Exception e) {
          e.printStackTrace();
        }

        final JMenuBar mb = new JMenuBar();

        final JMenu file = new JMenu("File");
        file.setMnemonic(KeyEvent.VK_F);
        mb.add(file);

        final JToolBar toolbar = new JToolBar();
        final JButton button = new JButton("Button");
        toolbar.add(button);

        final JLabel label = new JLabel("Basic Colors");

        final JPanel panel = new JPanel(new BorderLayout());
        panel.add(toolbar, BorderLayout.PAGE_START);
        panel.add(label, BorderLayout.CENTER);       

        final JFrame frame = new JFrame();
        frame.setJMenuBar(mb);
        frame.add(panel);

        frame.setTitle("Test"); 
        frame.setSize(400,200);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
      }
    });
  }
}

Output, compared with a native Windows app on Vista:

comparison

While the text in the test app menu bar is sized correctly, the rest of the text is smaller than in the native app next to it. Zoomed in, you can see that the text in the test app JLabel is 1px shorter than in the native app:

zoomed in

Is this a bug in the Windows LaF, or are we misusing it? If it’s a bug, is there a known workaround?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:08:45+00:00Added an answer on May 25, 2026 at 11:08 pm

    Java 6 uses its own font renderer, including the implementation of subpixel antialiasing / hinting whatsit. While the output is meant to be similar to Windows’ rendering, either the top of the B being at a pixel boundary, or it being rounded, or both, throws the Java renderer off. The Windows font renderer decides to place the top of the letter above the boundary, while the Java one places it below. The ‘l’ looks like it’s at the same height in both samples, so it doesn’t seem like the renderer gets the height of every letter wrong. Maybe try comparing with some letters where the top is a straight line, like a T or an E?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some Windows native applications have a question mark icon on the title bar. It's
I am a native windows programmer and I was just starting to develop some
I have some native (as in /SUBSYSTEM:NATIVE ) Windows programs that I'd like to
Is there a Java library to access the native Windows API? Either with COM
In a Java project, I am using a third-party library that loads some native
I've always seen memory viewers for native windows application, but Java Applications run in
I've been working with Windows API calls so that I can get some native
I am trying to use native windows API with Qt using mingw toolset. There
how can I catch all strings from a native windows .exe file and replace
We have Win Forms application uses the 3rd party windows native controls. Can these

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.