I've been looking all over for some mention of this, but I cannot find any substantial information on it. Is there a way to change the z-order of Swing components, or at least change the draw order so that they appear to be above others?
In Java Swing, there are a number of components like a scroll bar, button, text field, text area, checkbox, radio button, etc. All these components together, form a GUI that offers a rich set of functionalities and also allows high-level customization.
As we mentioned before, Swing provides three generally useful top-level container classes: JFrame , JDialog , and JApplet .
Java (Swing/AWT) uses something called LayoutManager s to place UI components on the screen. These LayoutManagers are responsible to render component such as TextField, CheckBox, etc in a predefined manner on your Window. For example: A LayoutManager called FlowLayout simply places components one after the other.
You are looking for setComponentZOrder
Here's an example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With