954,549 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Setting the location of radio button !?!

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.

uurcnyldrm
Newbie Poster
17 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

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?

NormR1
Posting Expert
Moderator
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
 

yes, there is no layout manager for that panel.

uurcnyldrm
Newbie Poster
17 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

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

NormR1
Posting Expert
Moderator
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
 

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

uurcnyldrm
Newbie Poster
17 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

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

NormR1
Posting Expert
Moderator
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: