Question

I am dealing with a problem which relates to this bug I think: DefaultDesktopManager does not handle InternalFrame state changes as expected.

I have the following scenario:

My application consists of a JFrame which can have several JInternalFrames. As an overview dialog I have a JInternalFrame which is maximized and shows a data table. The user can open a detail dialog for an entity in the table. The detail dialog is also a JInternalFrame.

  1. Problem: Because the overview dialog was maximized the detail dialog is also maximized (what is not like expected).

  2. Problem: When the detail dialog gets closed the overview dialog loses its maximized state. If the user clicks on any point in this dialog it gets back maximized. That's pretty ugly and confusing to the users. If I "un-maximize" the detail dialog before closing it the overview dialog also loses its maximied state and stays in this state.

It seems to me that the JFrame can only hold one global state for all its JInternalFrames. I don't know how to create a simple workaround for this. Maybe someone had this trouble in the past and can guide me.

It is a bit hard to provide a SSCCE, maybe this is enough, I am showing the detail dialog by this:

DetailDialog detailDialog = new DetailDialog();
applicationFrame.getDesktopPane().add(detailDialog);
detailDialog.setVisible(true);
Était-ce utile?

La solution 2

I found my mistake. I am using a controller class for the dialog and delegating the closing of the dialog to that class. In the controller I have to do some validations for example and then I call dispose() of the dialog. Now I am calling setClosed(true) instead which works. I think there where some fired events missing which are now fired.

Autres conseils

could be questions

  1. hard to write something wise without seeing your SSCCE

  2. what output you'll expecting from JInternalFrame[] getAllFrames(), is there some ???

  3. what output you'll expecting from Internal Frame Listener, is there some ???

  4. did you place JInternalFrame to the JLayeredPane???

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top