Hi people,

How can I put a JRadioButton wherever I want in a JPanel? I tried setLocation() but it did not change anything. It is still on the north-center part of the panel. I think I'm missing something, but I can't figure it out. Thank you in advance.

Recommended Answers

All 5 Replies

Did you remove the layout manager so that you have exclusive control vs competing with the layout manager over who gets to set the location of a component?

yes, there is no layout manager for that panel.

Can you post a small program that compiles, executes and shows the problem?

Thank you for your concern, but I fixed it. I set the layout null and use setBounds() method for the radio button.

Glad you found it. That was what I was saying about the layout manager: remove the layout manager.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.