Re: GridBagLayout and changing constraints objects.
- From: "Daniel Pitts" <googlegroupie@xxxxxxxxxxxxx>
- Date: 26 Mar 2007 09:53:32 -0700
On Mar 26, 2:46 am, Ian Wilson <scoblo...@xxxxxxxxxxxxx> wrote:
Daniel Pitts wrote:
Say I have the following code:
OK, I shall ...
JPanel myPanel = new JPanel(new GridBagLayout());
GridBagConstraints constaints = getConstraints();
myPanel.add(new JLabel("Hello world"), constaints);
And then later (as a result of an Event), I do something like
constraints.gridx = 3;
myPanel.revalidate();
Will this have the expected effect, or do I need to remove the old
label, and re-add it with the new constraints?
Others have given the answer you were seeking. However I can't help
noticing that the code you quoted can never have the expected effect
since constaints != constraints :-)
Did I surround that code with an sscce tag? I don't think so. :-)
.
- References:
- Re: GridBagLayout and changing constraints objects.
- From: Ian Wilson
- Re: GridBagLayout and changing constraints objects.
- Prev by Date: Re: GridBagLayout and changing constraints objects.
- Next by Date: How to lock a tree node so that it won't ever collapse
- Previous by thread: Re: GridBagLayout and changing constraints objects.
- Next by thread: Re: GridBagLayout and changing constraints objects.
- Index(es):
Relevant Pages
|