Reputation: 189806
I have a JPanel with one component that I want to place in an absolute sense, whereas the rest of the components are placed according to a layout manager.
Is there a simple way to do this?
Upvotes: 2
Views: 621
Reputation: 205865
You might also want to look at OverlayLayout
, seen here. For some reason it's excluded from the conventional gallery, but it may be of interest.
Upvotes: 3
Reputation: 324147
Are you saying you want a component painted over top of all the other components? If so then you would need to use a JLayeredPane.
Why don't you post a SSCCE that demonstrates what you want to do?
You can add components to a frame as you would do normally and make the frame visible. Then you can add this random component and use setBounds on the component. As long as you don't revalidate() the panel or resize the frame we will be able to see how you intend to position this component relative to all the other components.
Upvotes: 4