-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
1.4.0, 1.4.2
-
x86
-
linux, windows_xp
Name: jk109818 Date: 09/09/2002
FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
FULL OPERATING SYSTEM VERSION :
SuSE Linux 8.0, Linux Kernel 2.4.18, glibc 2.2.5
ADDITIONAL OPERATING SYSTEMS :
A DESCRIPTION OF THE PROBLEM :
Currently, a top-level window doesn't directly honor the
minimum/maximum size set on e.g. a JFrame.
There is a (ugly) workaround for this problem:
http://www.javaworld.com/javaworld/javaqa/1999-10/03-qa-window.html
It would be trivial to add the top-level minimum/maximum size
to the XSetWMNormalHints() call that is done anyway.
On Windows, the WM_GETMINMAXINFO notification could be used to
enforce the minimum/maximum size.
I know that not all X window managers handle the hint, but almost
all sane do ;-)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create a JFrame with some stuff in it
2. System.out.println("frame min size should be= "+frame.getMinimumSize());
3. resize the window
EXPECTED VERSUS ACTUAL BEHAVIOR :
I would expect that the window doesn't shrink below its minimum size,
but it does :-(
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
/**
* Small test to see the min max proplem
*/
public class MinMaxTest
{
/**
* Sets the UI up
* @param args not used
*/
public static void main(String[] args)
{
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints constrain= new GridBagConstraints();
constrain.gridx = 0;
constrain.gridy = 0;
constrain.insets.left = 2;
constrain.insets.right= 2;
JLabel label = new JLabel("TestLabel");
panel.add(label, constrain);
constrain= new GridBagConstraints();
constrain.gridx = 1;
constrain.gridy = 0;
constrain.fill = GridBagConstraints.HORIZONTAL;
constrain.weightx= 1.;
JButton button = new JButton("Testbutton");
panel.add(button,constrain);
JFrame frame= new JFrame("TestFrame");
frame.getContentPane().add(panel);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
System.out.println("frame min size= "+frame.getMinimumSize());
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
http://www.javaworld.com/javaworld/javaqa/1999-10/03-qa-window.html
but ugly as hell ...
(Review ID: 164198)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
FULL OPERATING SYSTEM VERSION :
SuSE Linux 8.0, Linux Kernel 2.4.18, glibc 2.2.5
ADDITIONAL OPERATING SYSTEMS :
A DESCRIPTION OF THE PROBLEM :
Currently, a top-level window doesn't directly honor the
minimum/maximum size set on e.g. a JFrame.
There is a (ugly) workaround for this problem:
http://www.javaworld.com/javaworld/javaqa/1999-10/03-qa-window.html
It would be trivial to add the top-level minimum/maximum size
to the XSetWMNormalHints() call that is done anyway.
On Windows, the WM_GETMINMAXINFO notification could be used to
enforce the minimum/maximum size.
I know that not all X window managers handle the hint, but almost
all sane do ;-)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create a JFrame with some stuff in it
2. System.out.println("frame min size should be= "+frame.getMinimumSize());
3. resize the window
EXPECTED VERSUS ACTUAL BEHAVIOR :
I would expect that the window doesn't shrink below its minimum size,
but it does :-(
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
/**
* Small test to see the min max proplem
*/
public class MinMaxTest
{
/**
* Sets the UI up
* @param args not used
*/
public static void main(String[] args)
{
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints constrain= new GridBagConstraints();
constrain.gridx = 0;
constrain.gridy = 0;
constrain.insets.left = 2;
constrain.insets.right= 2;
JLabel label = new JLabel("TestLabel");
panel.add(label, constrain);
constrain= new GridBagConstraints();
constrain.gridx = 1;
constrain.gridy = 0;
constrain.fill = GridBagConstraints.HORIZONTAL;
constrain.weightx= 1.;
JButton button = new JButton("Testbutton");
panel.add(button,constrain);
JFrame frame= new JFrame("TestFrame");
frame.getContentPane().add(panel);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
System.out.println("frame min size= "+frame.getMinimumSize());
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
http://www.javaworld.com/javaworld/javaqa/1999-10/03-qa-window.html
but ugly as hell ...
(Review ID: 164198)
======================================================================
- duplicates
-
JDK-6200438 Frame's size must be validated against maximized bounds when resizing, win32
- Closed