Re: GridBagLayout and changing constraints objects.
- From: Ian Wilson <scobloke2@xxxxxxxxxxxxx>
- Date: Mon, 26 Mar 2007 10:46:04 +0100
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 :-)
.
- Follow-Ups:
- Re: GridBagLayout and changing constraints objects.
- From: Daniel Pitts
- Re: GridBagLayout and changing constraints objects.
- Prev by Date: Re: GridBagLayout and changing constraints objects.
- Next by Date: Re: MacOS X: annoying rectangle during drag and drop
- Previous by thread: Re: GridBagLayout and changing constraints objects.
- Next by thread: Re: GridBagLayout and changing constraints objects.
- Index(es):
Relevant Pages
|
|