Re: GridBagLayout and changing constraints objects.
- From: "Larry Barowski" <MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND>
- Date: Mon, 26 Mar 2007 10:20:46 -0400
"Daniel Pitts" <googlegroupie@xxxxxxxxxxxxx> wrote in message
news:1174860473.305833.284620@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Say I have the following code:
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?
It will have no effect. Normally you change the (single) constraints
object between adding components. There is no need to create
multiple constraints objects. To change after creation, I assume you
can use GridBagLayout.setConstraints(). You could use
GridBagLayout.getConstraints(), make the change, then use
setConstraints() to avoid storing the constraints object.
.
- Prev by Date: Re: MacOS X: annoying rectangle during drag and drop
- Next by Date: Re: GridBagLayout and changing constraints objects.
- Previous by thread: Re: GridBagLayout and changing constraints objects.
- Next by thread: Re: GridBagLayout and changing constraints objects.
- Index(es):