1

I am writing an application with small fonts in JLabels meant to be displayed on large low res screens.

I create a JLablel using this code, the JFrame has white background.

JLabel myJlabel=new JLabel();
myJlabel.setFont(new Font("Terminal",0,8));
myJlabel.setForeground(Color.black);
myJlabel.setText("Hamburger");

But it looks blurry. The image blow illustrates my problem. On the left it is from a screenshot of my application and on the right it is from the Notapad.exe with the same font and size. One if blurry and on is not.

enter image description here

Here is the images again enlarged and re-screen shot so you won't need to zoom to see my problem.

enter image description here

I need the labels in Java to be just as sharp as on the right. Is there a way to make JLabels not blurry?

DavidPostill
  • 7,734
  • 9
  • 41
  • 60
ledd
  • 23
  • 1
  • 5
  • i tested this code, i could not find any blurness, just increase font size,that may solve your problem – Anptk Sep 18 '14 at 07:52
  • probably has something to do with graphical scaling of your application. I get this sometimes with applications on my desktop.. I need to change the properties in my short cut link. – Oliver Watkins Sep 18 '14 at 07:55
  • My problem is that I can't increase the font size. I needs to be 8 points in this case. – ledd Sep 18 '14 at 08:10

1 Answers1

1

I don't know, as you haven't provided any code, but if you have anti-aliasing enabled, that can cause the text to be displayed like it is:

    System.setProperty("awt.useSystemAAFontSettings","on"); 
    System.setProperty("swing.aatext", "true");

Try removing these (if they exist), or setting them to "off" and "false" respectively.

Gorbles
  • 1,169
  • 12
  • 27