JDK-1231233 : Frame.setResizable(false) does not prevent resizing.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version:
    1.0,1.1,1.1.1,1.1.3,1.1.4,1.1.4a,1.1.5,1.2.0 1.0,1.1,1.1.1,1.1.3,1.1.4,1.1.4a,1.1.5,1.2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS:
    solaris_2.5,solaris_2.5.1,solaris_2.6,windows_95,windows_nt solaris_2.5,solaris_2.5.1,solaris_2.6,windows_95,windows_nt
  • CPU: x86,sparc
  • Submitted: 1995-12-09
  • Updated: 1998-08-13
  • Resolved: 1998-08-13
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.
Other Other
1.1.5 1.1.5Fixed 1.2.0Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
java.awt.Frame.setResizable(false) does not prevent the user from resizing the frame

Steps to reproduce:
Compile and run the attached code
Press <UnSet Resizable>
<Click + Drag> any corner of the window

import java.awt.*;

public class FrameTest extends AppFrame
{
    final String RESIZABLE = "Set Resizable";
    final String NOTRESIZABLE = "UnSet Resizable";
    Label label;

    public static void main(String args[])
    {
       FrameTest f = new FrameTest();
       f.show();       
    }

    public FrameTest()
    {
       super("Frame Test");
       Panel panel = new Panel();

       add("North", panel);
       panel.add( new Button(RESIZABLE) );
       panel.add( new Button(NOTRESIZABLE) );
       panel.add( label = new Label( new Boolean( isResizable() ).toString() ) );
       resize(200, 200);       
    }

    public boolean action(Event evt, Object obj)
    {
       if (evt.target instanceof Button)
       {
          String lbl = (String) obj;
          if ( lbl.equals(RESIZABLE) )
             setResizable(true);
          else if ( lbl.equals(NOTRESIZABLE) )
             setResizable(false);
          else
             return false;

          label.setText( new Boolean( isResizable() ).toString() );
          return true;

       }
       return super.action(evt, obj);
    }
}

/* Generic Full Application Frame
 * @(#)AppFrame.java	1.4  15 Nov 1995 15:48:24
 * @author Kevin A. Smith
 *
 * The class AppFrame provides an  AWT Frame window for running
 * applications.  
 *
 */

import java.awt.Frame;
import java.awt.Event;
import java.awt.MenuItem;

// Application Frame window
class AppFrame extends Frame
{
    // constructor needed to pass window title to class Frame
    public AppFrame(String name)
    {
       // call java.awt.Frame(String) constructor
       super(name);
    }

    // needed to allow window close
    public boolean handleEvent(Event e)
    {
       // Window Destroy event
       if (e.id == Event.WINDOW_DESTROY)
          return appExit(0);
       
       // it's good form to let the super class look at any 
       // unhandled events
       return super.handleEvent(e);

    }  // end handleEvent()

    // Generic Action event handler
    public boolean action(Event evt, Object obj)
    {
       if(evt.target instanceof MenuItem)
          return menuEvent(evt, obj);
       else
          // it is good form to let the super class look at any
          // unhandled events.
          return super.action(evt, obj);

    }  // end action()

    // Generic Menu event handler
    public boolean menuEvent(Event evt, Object obj)
    {
       String menuLabel = obj.toString();

       if( menuLabel.equals("Exit") )
       {
          // This menu item is the same as Close
          return appExit(0);
       }

       else
          // menu event handler did nothing with this event.
          // In a fully written application, you should never
          // get to this line.
          return false;

    }  // end menuEvent()

    // application exit code
    protected boolean appExit(int exitCode)
    {
       System.exit(exitCode);
       return true;
    }

}   // end class AppFrame
=============================================================================

roger.lewis@Eng 1997-07-16

Release: 1.1.3
Hardware: i586
OSversion: win_95

Synopsis: setResizable(false) still lets you maximize a frame

Description: 
1. Put setResizable(false) in the initialization of a frame.
2. Run the program
3. Double-click the header or press the maximize button.
4. The window is maximized with the contents in the upper left corner.



company - OPUS DA , email - ###@###.###
=============================================================================

hi,

    Currently Frames do not have methods to enable and disable minimize and maximize buttons. 
Only way out is to disable events to these buttons. Better method would be to have functions 
which allow the prograammer to enable or disable these buttons.

Regards,
Dipanshu.




Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic FIXED IN: 1.1.5 1.2beta2 INTEGRATED IN: 1.1.5 1.2beta2 VERIFIED IN: 1.1.5
14-06-2004

SUGGESTED FIX 1997-07-08, pauly This same bug was available in dialog windows too. A fix has been implemented for it there; please see "Suggested Fix" for 4054823 and 4054984 (javaworks). Changes similar to those in awt_Dialog.c should be done in awt_Frame.c for this.
11-06-2004

PUBLIC COMMENTS java.awt.Frame.setResizable(false) does not have any effect on Solaris.
10-06-2004

EVALUATION paul.young@eng 1997-10-08 A suggested fix has been putback to JDK1.1-AWT.
08-10-1997