Steve M
Steve M

Reputation: 9784

Vertically maximizing window in Swing

When vertically maximizing a window on my win7 64 bit machine by dragging the top or bottom edge of the window to the top or bottom portion of the screen respectively, the application becomes unresponsive and displays a black section or some other visual distortion. Does not happen when vertically maximizing by double clicking on the edge, or regular maximizing.

Since its happening with the Java Tutorial programs (I selected a few at random, and they all do it), is this some kind of bug in Swing - or is there something I can do?

Upvotes: 0

Views: 623

Answers (2)

Stevens Miller
Stevens Miller

Reputation: 1480

This SSCCE shows the problem under Windows 7 (both 64-bit and 32-bit versions), compiled with JDK 1.7.0_07, running JRE 1.7.0_07:

public class Expander extends javax.swing.JFrame   
{   
    public Expander()   
    {   
        this.setBounds(0, 0, 300, 300);   
    }   

    public static void main(String args[])   
    {   
        java.awt.EventQueue.invokeLater(new Runnable()   
        {   
            public void run()   
            {   
                new Expander().setVisible(true);   
            }   
        });   
    }   
}  

Problem appears to be that no resize event is passed to the content pane of the JFrame. The JFrame's paint method does get the new size, but nothing inside it does. Problem does not appear under version 1.6 (can't test it under Linux as, apparently, the auto-resize behavior is unique to Windows).

See http://www.coderanch.com/t/601457/GUI/java/Vertically-Maximizing-Window-Swing for a more detailed discussion. I have filed a bug report on this at bugs.sun.com.

Upvotes: 2

Hele
Hele

Reputation: 1578

I am using a system of the i7-2600k, ati radeon 6800 and win7 64bit and i've never had any such problems. Are you using the latest version of Java? I made the following program. It works fine on my system under without any problems.

Download link to JPositioner : JPositioner

Please check and let me know if u are facing the same problems even with JPositioner.

Upvotes: 0

Related Questions