This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 32820

Summary: Cannot set JFrame's defaultCloseOperation to EXIT_ON_CLOSE
Product: guibuilder Reporter: gorank <gorank>
Component: CodeAssignee: issues@guibuilder <issues>
Status: VERIFIED FIXED    
Severity: blocker CC: jglick
Priority: P3 Keywords: JDK_SPECIFIC
Version: 3.x   
Hardware: PC   
OS: Windows ME/2000   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 20751    
Bug Blocks: 32199    

Description gorank 2003-04-11 07:05:04 UTC
For Jframe it is not posible to use Property editor to set 
defaultCloseOperation to EXIT_ON_CLOSE.
Comment 1 Tomas Pavek 2003-04-14 08:44:08 UTC
Confirming. There is a security exception...

org.netbeans.ExitSecurityException: Illegal attempt to exit early
        at
org.netbeans.TopSecurityManager.checkExitImpl(TopSecurityManager.java:118)
        at
org.netbeans.TopSecurityManager$PrivilegedCheck.run(TopSecurityManager.java:450)
        at java.security.AccessController.doPrivileged(Native Method)
        at
org.netbeans.TopSecurityManager$PrivilegedCheck.check(TopSecurityManager.java:475)
        at
org.netbeans.TopSecurityManager$PrivilegedCheck.checkExit(TopSecurityManager.java:463)
        at
org.netbeans.TopSecurityManager.checkExit(TopSecurityManager.java:101)
        at javax.swing.JFrame.setDefaultCloseOperation(JFrame.java:356)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.netbeans.modules.form.RADProperty.setTargetValue(RADProperty.java:101)
...
Comment 2 Tomas Pavek 2003-04-14 18:26:56 UTC
Looks like the problem appears with jdk 1.4.1, but not with 1.4.0.
Comment 3 aldobrucale 2003-04-14 19:12:52 UTC
It also happens with jdk 1.4.2 beta
Comment 4 Jesse Glick 2003-05-03 16:18:42 UTC
http://javadiff.sourceforge.net/jdiff/reports/j2se140_j2se141_docs/changes/docdiffs_javax.swing.html#javax.swing.JFrame.dmethod.setDefaultCloseOperation(int)

Issue #20751 made the NetBeans JVM reject the security permission for
VM exit, which JFrame requests as of 1.4.1 for this property.

The form editor must not actually attempt to set the property
JFrame.defaultCloseOperation, at least not to EXIT_ON_CLOSE. Generate
code for it, but don't call it at design time.
Comment 5 Tomas Pavek 2003-05-03 16:39:21 UTC
Thanks for finding this out. Another "nice" hack to be put to form
editor...
Comment 6 Jiri Mzourek 2003-05-29 17:06:54 UTC
I don't think that subcomponent "graphics" is the right one...
Comment 7 Tomas Pavek 2004-02-13 17:05:26 UTC
Fixed.
Comment 8 Jaromir Uhrik 2004-02-25 11:34:07 UTC
It is fixed now, but another problem appears - see newly added issue 
#40458.