-
Bug
-
Resolution: Won't Fix
-
P3
-
None
-
5.0
-
generic
-
generic
Changing the Z Order of components using setComponentZOrder method with Swing components results in component mix up. This occurs with all layouts. This is reproducible in all platforms with tiger rc build.
Steps to reproduce:
1. Run the attached code.
2. Wait for 5 secs and the Z Order of a text field present in the JFrame is changed and repainted. After this, only the text field is displayed in the JFrame.
3. Now move the mouse inside the frame. In can be seen that the buttons appear now. Type something and now the components overlap.
The issue here is that the setComponentZOrder method called for JFrame, re-parents the JTextField. After the method call, JFrame will be parent of the JTextField instead of the JFrame's contentPane. So setComponentZOrder must be over ridden in JFrame, to add the component to the contentPane, similar to JFrame's add method.
Steps to reproduce:
1. Run the attached code.
2. Wait for 5 secs and the Z Order of a text field present in the JFrame is changed and repainted. After this, only the text field is displayed in the JFrame.
3. Now move the mouse inside the frame. In can be seen that the buttons appear now. Type something and now the components overlap.
The issue here is that the setComponentZOrder method called for JFrame, re-parents the JTextField. After the method call, JFrame will be parent of the JTextField instead of the JFrame's contentPane. So setComponentZOrder must be over ridden in JFrame, to add the component to the contentPane, similar to JFrame's add method.
- relates to
-
JDK-6252682 Make Container.setComponentZOrder non final
- Resolved
-
JDK-6265511 Swing JFrame/JWindow/JApplet/JDialog: getLayout and remove should forward to content pane
- Closed