Bug 22981 - swing: javax.swing.JInternalFrame.setDefaultCloseOperation(EXIT_ON_CLOSE) not handled
swing: javax.swing.JInternalFrame.setDefaultCloseOperation(EXIT_ON_CLOSE) not...
Status: RESOLVED FIXED
Product: classpath
Classification: Unclassified
Component: classpath
unspecified
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-06-16 09:16 UTC by from-classpath
Modified: 2005-07-23 22:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description from-classpath 2005-06-16 09:16:57 UTC
Steps to reproduce:
1. Run the attached testcase.

Expected results:
1. Program exits sucessfully

Actual results:
1. Following exception is thrown:
java.lang.Error: Close operation must be one of DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, or DISPOSE_ON_CLOSE
   at javax.swing.JInternalFrame.setDefaultCloseOperation (JInternalFrame.java:1291)
   at testcase.<init> (testcase.java:8)
   at testcase.main (testcase.java:5)


Testcase:
import javax.swing.*;
import java.awt.*;
public class testcase extends JInternalFrame {
        public static void main(String[] args) {
                (new testcase()).show();
        }
        public testcase() {
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }
}
Comment 1 from-classpath 2005-06-16 17:53:37 UTC
Why is this an error?  I don't believe EXIT_ON_CLOSE is valid for JInternalFrame.

EXIT_ON_CLOSE is specific to JFrames.
Comment 2 from-classpath 2005-06-16 19:16:42 UTC
I have seen something similar in JDialog and or JFrame. Invalid values should not throw an exception but should instead be swallowed and lead to the default behaviour, AFAICR.
Comment 3 from-classpath 2005-06-24 09:17:17 UTC
No exception seems to be thrown anymore.