I have a desktop Java application i'm working on and have been using JDK 6 for development via IDE. I use the rendering hint VALUE_FRACTIONALMETRICS_ON
along with other hints to better render text in JLabels. These hints work beautifully on JVM 1.6 but i've recently noticed that it seems to ignore the VALUE_FRACTIONALMETRICS_ON
completely when I run the app with a JRE 1.7 Is there something i'm doing wrong here that makes Java 7 ignore these hints?
lblDate = new ATimeLabel(ATimeLabel.DATE_LETTERS) {
private static final long serialVersionUID = 1L;
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
super.paintComponent(g2d);
}
};
FRACTIONALMETRICS has the biggest noticeable visual effect on text so getting that to work is what i'm looking to do.
here is a screen shot comparison of what it looks like when I run the app from my IDE (Left) which uses Java 6 and when I double click the Jar file its self (Right) which uses my systems JRE, Java 7. (I also temporary added the red border to show that the paint method does work)
Any help would be very much appreciated.