Article View: borland.public.jbuilder.java.swing
Article #11879Re: GridbagLayout
From: Vasudevan Srinivasan
Date: Fri, 09 Apr 1999 00:00
Date: Fri, 09 Apr 1999 00:00
52 lines
2220 bytes
2220 bytes
if you want to avoid adding the jbcl package, here is one way:
I defined a method setConstraints(...) with standard grid bag values,
which returns a ref to GridBagConstraints. You can always use
convenience methods to shorten the no of parameters
//How to use it.
basePanel.setLayout(gridBagLayout1);
basePanel.add(controlPanel, setConstraints(0, 0, 2, 1, 0.0, 0.0,
GridBagConstraints.CENTER));
basePanel.add(textPanel, setConstraints(0, 1, 1, 1, 1.0, 0.0,
GridBagConstraints.EAST));
.....
GridBagConstraints setConstraints(int x, int y, int cw, int ch, double
wx, double wy, int anc, int fill, int padx, int pady) {
GridBagConstraints c = new GridBagConstraints();
c.gridx = x; c.gridy = y;
c.gridheight = ch; c.gridwidth = cw;
c.weightx = wx; c.weighty = wy;
c.anchor = anc;
c.ipadx = padx; c.ipady = pady;
c.fill = fill;
return c;
}
//Example of convenience method
GridBagConstraints setConstraints(int x, int y, int cw, int ch, double
wx, double wy, int anc) {
return setConstraints(x, y, cw, ch, wx, wy, anc,
GridBagConstraints.BOTH, 0,0);
}
"Morten V�rum" wrote:
> I have a problem with JBuilder2.
> I want to develp an application using only AWT and SWING classes.
>
> Even though I have checked the box, I get into trouble when I want
> to use the GridbagLayout.
> JBuilder insist on importing a borland package and make use of
> a class called GridbagConstraints2. Not available in AWT.
>
> Is it a bug and is there a way around this?
>
> Please use email for your answer (mv@enator.dk)
>
> Thanx in advance
>
> /Morten Vaerum
Technical Details
Message-ID:
<370E2AD8.45261852@netrisk.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7ekecq$3sg7@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111d45,49350a07a29e3e27 X-Google-Attributes: gid111d45,public From: Vasudevan Srinivasan <vasudevan@netrisk.com> Subject: Re: GridbagLayout Date: 1999/04/09 Message-ID: <370E2AD8.45261852@netrisk.com> X-Deja-AN: 464480031 Content-Transfer-Encoding: 8bit References: <7ekecq$3sg7@forums.borland.com> To: Morten Værum <mv@enator.dk> X-Accept-Language: en Content-Type: text/plain; charset=iso-8859-1 Organization: NetRisk Inc Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing