Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setModalityType() not yet supported #29

Open
ghost opened this issue Jan 18, 2019 · 7 comments
Open

setModalityType() not yet supported #29

ghost opened this issue Jan 18, 2019 · 7 comments

Comments

@ghost
Copy link

ghost commented Jan 18, 2019

This is a follow up issue to the issue here:
#16 (comment)

I just noticed that modal dialogs are not fully modal. I can still interact with
the menu bar of the applet. As a result I can open the same modal dialog
multiple times. Here I open it the first time:

unbenannt

@ghost
Copy link
Author

ghost commented Jan 18, 2019

Now I can still interact with the menu of the applet, and can
open the modal dialog a second time:

about_interaction

@ghost
Copy link
Author

ghost commented Jan 18, 2019

The second modal dialog opens on top of the present modal dialog:

unbenannt2

@ghost
Copy link
Author

ghost commented Jan 18, 2019

Usually for modal dialogs, the menus are blocked. It is even so that
Swing does a "beep", when I try to click into the menus.

BTW: I am using advanced Swing API to set the dialog to modal.
The advanced Swing API allows different sub modes of modal.
My code contains the following API call before making it visible:

        setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
        setVisible(true);

I use the advanced Swing API for some requirements for when
the code runs not from within a single applet, but when I have
multiple windows. Hold on, let me also test the traditional API.

@ghost
Copy link
Author

ghost commented Jan 18, 2019

Intersting I changed the code to the following:

        setModal(true);
//        setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
        setVisible(true);

And now the menu is blocked. Oki Doki. So the advanced API
is not yet working for applets. I can workaround my code accordingly.

@ghost ghost changed the title Applet menu bar not blocked, during modal dialog setModalityType() not yet supported Jan 18, 2019
@yuri91
Copy link
Member

yuri91 commented Jan 22, 2019

Hi @jburse , thanks for your report!

How did you create the JDialog? If you didn't specify the parent, Dialog.ModalityType.DOCUMENT_MODAL is not enough to prevent clicking on the applet.
You should use something like :

setModalityType(Dialog.ModalityType.APPLICATION_MODAL);

(Which should be equivalent to your workaround of setModal(true))

Can you provide us a test case showing different behaviour between CheerpJ and native Java (leaving aside the window stacking issue tracked in #31 )?

@ghost
Copy link
Author

ghost commented Jan 22, 2019

If you don't specify a parent, it still has a parent.
At least the JDK 1.8 source tells me:

   super(owner == null? 
       SwingUtilities.getSharedOwnerFrame() : owner,
              title, modal);

As soon as I have time, I can make more testing
with different modalities (there are not many).

@alexp-sssup
Copy link
Member

alexp-sssup commented Jan 22, 2019

@jburse The simplest thing would be for you to revert the workaround (i.e. using setModal(true)) so that we can directly test our applet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants