JDK-4320050 : Minimum size for java.awt.Frame is not being enforced.
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.3.0,5.0,6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS:
    generic,linux_redhat_8.0,windows_nt,windows_xp generic,linux_redhat_8.0,windows_nt,windows_xp
  • CPU: generic,x86
  • Submitted: 2000-03-09
  • Updated: 2017-05-16
  • Resolved: 2005-09-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b51Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
Name: krT82822			Date: 03/08/2000


8 Mar 2000, eval1127@eng -- easily worked around.  Could not find any still-open
bugs re. this, so am filing new one.

java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)

Since there is no method to set a minimum size on a java.awt.Frame, the most
obvious way to control this behavior is to extend the Frame object and override
the getMinimumSize() method. However, when this is done, the minimum size that
I set is not being enforced. Any other suggestions?

Sample code as follows:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

import java.awt.*;

public class ResizeTest extends Frame
{
   private final Dimension m_dim = new Dimension(200, 150);

   public static void main(String args[])
   {
      new ResizeTest("Resize Test");
   }

   public ResizeTest(String title)
   {
      super(title);
      setLayout(new BorderLayout());
      setSize(m_dim);
      show();
   }

   public Dimension getPreferredSize() { return m_dim; }
   public Dimension getMinimumSize()   { return m_dim; }
}
(Review ID: 102158) 
======================================================================

Comments
EVALUATION Need some new methods for minimum and maximum size of a frame. Commit to Tiger. richard.ray@eng 2000-03-17 Necessary javadoc changes: (Preliminary Specification) java.awt.Window: /** * Sets the minimum size of this window to a constant * value. Subsequent calls to <code>getMinimumSize</code> * will always return this value. If current window's * size is less than specified by <code>minimumSize</code> * param it's automatically enlarged. If <code>setSize</code> * or <code>setBounds</code> call is made with width and height * less than specified by <code>setMinimumSize</code> window * will by automatically enlarged to minimumSize value. * Setting the minimum size to <code>null</code> restores * the default behavior. * <p> * Resizing operation may be restricted if user tries * to resize window below the <code>minimumSize</code> value. * This behaviour is platform-dependent. * * @param minimumSize the new minimum size of this window * @see Component#setMinimumSize * @see #getMinimumSize * @see #isMinimumSizeSet * @see #setSize(Dimension) */ public void setMinimumSize(Dimension minimumSize) /** * {@inheritDoc} * <p> * Values of <code>d.width</code> or <code>d.height</code> * will be automatically enlarged if they are less than * window's minimum size specified by previous call to * <code>setMinimumSize</code>. * * @see #getSize * @see #setBounds * @see #setMinimumSize */ public void setSize(Dimension d) /** * {@inheritDoc} * <p> * Values of <code>width</code> or <code>height</code> * will be automatically enlarged if they are less than * window's minimum size specified by previous call to * <code>setMinimumSize</code>. * * @see #getSize * @see #setBounds * @see #setMinimumSize */ public void setSize(int width, int height) /** * {@inheritDoc} * <p> * Values of <code>width</code> or <code>height</code> * will be automatically enlarged if they are less than * window's minimum size specified by previous call to * <code>setMinimumSize</code>. * * @see #getBounds * @see #setLocation(int, int) * @see #setLocation(Point) * @see #setSize(int, int) * @see #setSize(Dimension) * @see #setMinimumSize * @see #setLocationByPlatform * @see #isLocationByPlatform * @since 1.5 */ public void setBounds(int x, int y, int width, int height) /** * {@inheritDoc} * <p> * Values of <code>r.width</code> or <code>r.height</code> * will be automatically enlarged if they are less than * window's minimum size specified by previous call to * <code>setMinimumSize</code>. * * @see #getBounds * @see #setLocation(int, int) * @see #setLocation(Point) * @see #setSize(int, int) * @see #setSize(Dimension) * @see #setMinimumSize * @see #setLocationByPlatform * @see #isLocationByPlatform * @since 1.5 */ public void setBounds(Rectangle r) /** * @deprecated As of JDK version 1.1, * replaced by <code>setBounds(int, int, int, int)</code>. */ @Deprecated public void reshape(int x, int y, int width, int height) ###@###.### 2005-06-10 13:18:36 GMT
10-06-2005

SUGGESTED FIX On Win32 window's minimum size can be enforced using WM_GETMINMAXINFO message, On XWin uning normal window's hints (setNormalHints function). 1. Need to add new method to WindowPeer interface: void updateMinimumSize(); NB! This method has no agruments. When this method is called peer should request minimum size from tagret (target.getMinimumSize()) and return this value on subsequent WM_GETMINMAXINFO calls or modify window's hints. 2. Need to modify reshaping in window to supress setting size of window less than minimumSize. This would remove flicker on WM's that allow setting window size of window less than minimumSize. 3. Need to override Window.setMinimumSize(...) that should: - modify minimumSize (i.e. invoke superclass) - enlarge window if it's less than minimumSize - invoke peer's updateMinimumSize ###@###.### 2005-06-09 15:51:59 GMT
09-06-2005

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
17-09-2004

WORK AROUND Name: krT82822 Date: 03/08/2000 8 Mar 2000, eval1127@eng -- Frame.setResizable(false), or override setSize() to check if requested (new) size is less than desired minimum ======================================================================
17-09-2004