United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7124553 [macosx] Need minimum size for titled Frames and JFrames
JDK-7124553 : [macosx] Need minimum size for titled Frames and JFrames

Details
Type:
Bug
Submit Date:
2011-12-23
Status:
Closed
Updated Date:
2012-03-21
Project Name:
JDK
Resolved Date:
2012-03-05
Component:
client-libs
OS:
os_x
Sub-Component:
java.awt
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
7u4 (b13)

Related Reports
Backport:
Relates:

Sub Tasks

Description
http://java.net/jira/browse/MACOSX_PORT-166 submitted 2011/07/18 by ddurrence
Simple Frame or JFrame fails to draw unless one or more components are added and pack is called.
Compile and run one of the following simple test cases:
import javax.swing.JButton;
import javax.swing.JFrame;
public class SimpleJFrame
{
    public static void main(String[] args)
    {        JFrame frame = new JFrame("Boom!");        /* For the JFrame to show, it must have real content and pack must be called.           Uncomment the following two lines to have the frame draw on screen.         */        //        frame.add(new JButton("Bogus Button"));//        frame.pack();        frame.setVisible(true);    }}
— OR —
import java.awt.Frame;
import java.awt.Button;
public class SimpleFrame
{
    public static void main(String[] args)
    {        Frame frame = new Frame("Boom!");        /* For the Frame to show, it must have real content and pack must be called.         Uncomment the following two lines to have the frame draw on screen.         */        //        frame.add(new Button("Bogus Button"));//        frame.pack();        frame.setVisible(true);    }}

                                    

Comments
EVALUATION

Calling pack() for an empty frame is meaningless. We assume that the majority of user applications don't do that. It must be a really rare situation when an application wants to display a frame w/o any components. Therefore we consider this issue should have very low impact.
                                     
2012-02-08
EVALUATION

The size used for setBounds() and setMinMaxSize() operations must be constrained to always include the size of window decorations and the grow box when they're enabled. The size of (1, 1) is considered as the smallest possible size for a window in any case.

Sent for review: http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-February/003101.html
                                     
2012-02-15



Hardware and Software, Engineered to Work Together