Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Strange Swing bug in Oracle's JDK7

1062705Jan 2 2014 — edited Jan 3 2014

I have a strange bug with every java app i run with the Java 7 VM. Every frame is limited to a maximum width of 1024 pixels. Doesn't matter if you try to resize it by code or dragging the border with the mouse pointer.

I have a Macbook with Mac OSX 10.7.5 (1280x800 resolution).


If i try to run the apps with Apple's Java 6 VM all works as expected.

Here is a POC:

import javax.swing.*;

import java.awt.*;

public class JDK7Bug {

    public static void main(String[] args) throws InterruptedException {

        JFrame frame = new JFrame();

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        frame.setVisible(true);

        frame.setSize(800, 400);

        Thread.sleep(100);

        System.out.println("frame.setSize(800, 400); " + frame.getSize());

        frame.setSize(1100, 400);

        Thread.sleep(100);

        System.out.println("frame.setSize(1100, 400); " + frame.getSize());

        frame.setSize(1000, 400);

        Thread.sleep(100);

        System.out.println("frame.setSize(1000, 400); "+frame.getSize());

        System.out.println("ScreenSize: "+Toolkit.getDefaultToolkit().getScreenSize());

    }

}

It outputs:

frame.setSize(800, 400); java.awt.Dimension[width=800,height=400]

frame.setSize(1100, 400); java.awt.Dimension[width=1024,height=400]

frame.setSize(1000, 400); java.awt.Dimension[width=1000,height=400]

ScreenSize: java.awt.Dimension[width=1280,height=800]

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 31 2014
Added on Jan 2 2014
3 comments
2,191 views