Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Stopping a close window in forms 12c running Java web start config

DaveXAug 3 2016 — edited Sep 19 2016

I am trying to stop the window close from exiting a form when running forms 12c in web start configuration. I would like to stop the window close command and tell the user to use the form's toolbar exit button. I am defining the window close as either using the red X in the top right hand corner of the frame in which the form is running, or from the icon in the top left hand corner then selecting Close.

I am trying to use a java bean that extends VBean and I can find the frame and I am trying to stop the default behavior using

frame.addWindowListener(new WindowAdapter() {

             @Override

             public void windowClosing(WindowEvent ev) {               

             }

         });

I think I can get to the JFrame using

jfr = (JFrame) formsTopFrame;

and then I add a an adapter to override the existing one using

        jfr.addWindowListener(new WindowAdapter() {

            @Override

            public void windowClosing(WindowEvent ev) {

               

                int i = JOptionPane.showConfirmDialog(jfr,

                        "Please use toolbar button to exit the application", "Closing dialog",

                        JOptionPane.DEFAULT_OPTION);

            }

        });

And try to stop the default close using jfr.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE).

The result of this is that the window closes but I can see the dialog being displayed before the close. So, can you see why my attempts to stop the default close processing fail, or is there a better way to do this?

This post has been answered by DaveX on Sep 19 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 17 2016
Added on Aug 3 2016
13 comments
5,818 views