The key is the order in which you add components to the panel so that you get the Z-Ordering you desire. I am trying to make the z index changeable. Adding components to a panel will affect the Z-Order. Is it possible to set the z order value for a JComponent? I have a custom layout manager and some of my components overlap the problem is that the components are being drawn on top of each other in the wrong order. You need to add a MouseListener to the JLabel. When you click on the label then you can reset its Z-Order to 0. This will cause the label to be painted last and so it will be on top of all other labels on the panel. So the basic code in the MouseListener would be: aya-ueto-message-rar.componentZOrder(label, 0);.
Java Swing Tutorial A - Z : Part 2 : JTextField Usage (English subtitle), time: 6:03Tags: Z order in java swing,Z order in java swing,Z order in java swing.
Java Swing Tutorial A - Z : Part 3 : JPasswordField & JCheckBox Usage (English subtitle), time: 13:30Tags: Z order in java swing,Z order in java swing,Z order in java swing.