Java Authors: Elizabeth White, Pat Romanski, Liz McMillan, Adrian Bridgwater, Sharon Barkai

Blog Feed Post

Swing rendering seems to be broken in Java 8

Here’s a simple Java program that I wrote to test Swing GUI in Java 8 (I use JDK 1.8.0_05-b13):


import javax.swing.JFrame;
import javax.swing.JButton;

public class HelloWorld extends JFrame {

public static void main(String[] args) {
JFrame myWindow = new HelloWorld();

// Creating and adding a button the the container
JButton myButton = new JButton (“Click me”);

myWindow.setTitle(“Hello World”);

The program renders fine on MAC OS:

But this is what I get on Windows 7 Ultimate with JDK 1.8.0_05-b13:

In JDK 1.7 under Windows it works fine:


I’ve asked some people to try the same code with the same version of Java and they don’t see this issue. The only other reason I  can think of is that I’m connecting to the Windows VM remotely using Remote Desktop Connection from MAC OS. There’s is a chance that that program screws things up.

I’ve submitted a bug report to Oracle anyway, but if you use Java Swing, test your code before migrating to Java 8.

Read the original blog entry...

More Stories By Yakov Fain

Yakov Fain is a co-founder of two software companies: Farata Systems and SuranceBay. He authored several technical books and lots of articles on software development. Yakov is Java Champion (https://java-champions.java.net). He leads leads Princeton Java Users Group. Two of Yakov's books will go in print this year: "Enterprise Web Development" (O'Reilly) and "Java For Kids" (No Starch Press).