-
Bug
-
Resolution: Fixed
-
P3
-
1.0, 1.1, 1.1.1, 1.1.3, 1.1.4, 1.1.4a, 1.1.5, 1.2.0
-
1.1.5
-
x86, sparc
-
solaris_2.5, solaris_2.5.1, solaris_2.6, windows_95, windows_nt
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2010255 | 1.2.0 | Paul Young | P3 | Resolved | Fixed | 1.2beta2 |
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.
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.
- backported by
-
JDK-2010255 Frame.setResizable(false) does not prevent resizing.
- Resolved
- duplicates
-
JDK-4030112 Frame.setResizable( false) .
- Closed
-
JDK-4093131 JDialog.setResizable(false) does not work on Solaris
- Closed
- relates to
-
JDK-4178494 Min/Max buttons not created with Frame and JFrame when not resizable
- Resolved