Bookmark Topic Watch Topic
  • New Topic

Redrawing the UI

 
D Preethi
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi All,

I have a requirement in which I want to redraw a gridbaglayout panel based on a radio button selection. Can someone suggest me how to achieve this? Initially, the screen will look like this -

<Radio button 1>
<Radio button 2>
<Radio button 3>

On selection of radio button 2, I should show -
<Radio button 1>
<Radio button 2>
<JPanel 1>
<Radio button 3>

On selection of radio button 3, I should show -
<Radio button 1>
<Radio button 2>
<Radio button 3>
<JPanel 2>

On selection of radio button 1, I should show -
<Radio button 1>
<Radio button 2>
<Radio button 3>


What is the best way to achieve this? I was thinking of card layout for the entire screen (and switch between 3 UIs based on button selection), but that requires me to maintain 3 different instances of the 3 radio buttons (since the button click can happen in any order). Can someone please suggest me better method?


Thanks,
Preethi

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Report post to moderator
here's one way

[edit]
deleted - cross-posted at java.forums.org
 
Peter Taucher
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Report post to moderator
I don't know what some people call 'redrawing'. I'd simply place the JPanel components in the layout and only set one of them (corresponding to the selected JRadioButton) visible (and all others invisible). Wouldn't that be a simple and operative approach?
 
Rob Spoor
Sheriff
Pie
Posts: 20659
64
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Michael Dunn wrote:deleted - cross-posted at java.forums.org

Not just at java.forums.org - here as well.

D Preethi, please UseOneThreadPerQuestion, and BeForthRightWhenCrosspostingToOtherSites. This thread is closed.
 
    Bookmark Topic Watch Topic
  • New Topic