Article View: borland.public.jbuilder.java.api
Article #3205Re: Need help from a layout expert
From: Rich Wilkman
Date: Mon, 09 Mar 1998 00:00
Date: Mon, 09 Mar 1998 00:00
80 lines
4389 bytes
4389 bytes
Peter: There are a few ways to do this, most involve nested panels with different layouts. Assuming it's a Frame (from the menu bar), the Frame would have a BorderLayout with a MainPanel in it's center and the statusbar to the South. I would set the MainPanel layout to XY (temporarily) and add in a panel for the 6 buttons, a panel for the hide show button and stick in the TextArea to the right. The 6 button panel can be done easily with GridLayout, but exactly would require GridBag (it's a question of the extra space at the top and bottom of the set of buttons). You could use a ShapeControl to get your horizontal line, or just use BevelPanels and let the border do it for you. The Hide/Show button panel would be left alone (if the separator line goes on the 6 button panel) as FlowLayout would do what you describe and that's the default layout for a panel. Size the text area to use the remaining space. Switch the MainPanel to GridBagLayout. Don't grimace <g>. Tweak the constraints for the panels until you get the layout you want. Once those are set, work on the children of those panels. -Rich Peter Steele wrote: > > I'm having some difficulty in try to reproduce the UI behavior of a program > I've written in C++ Builder. The main form looks basically like this: > > +------------------------------------------------------------+ > | File Edit Help | > |------------------------------------------------------------| > | | | > | /------\ /------\ | Text area | > | |Button| |Button| | This should grow to east and | > | \------/ \------/ | south as window is resized. Its | > | | left edge is anchored at its | > | /------\ /------\ | designed position. If window is | > | |Button| |Button| | resized to be narrower than the | > | \------/ \------/ | text area's left edge, the text | > | | area should be clipped, as well | > | /------\ /------\ | as any buttons in the left hand | > | |Button| |Button| | area of the main form. | > | \------/ \------/ | | > | | If the Hide/Show button is | > |------------------------| pressed, the text area is | > | | hidden and resizing the window | > | (that's a horizontal | simply extends grey form back- | > | line above) | ground. The status bar of course | > | | is always anchored to the bottom | > | /---------\ | and if the window is too small | > | |Hide/Show| | to fit in the buttons they are | > | \---------/ | clipped. | > | | | > |------------------------------------------------------------| > | Status bar | > +------------------------------------------------------------+ > > This was trivial to set up in C++ Builder but I've been unable to come up > with a way to duplicate this behavior in Java. If anyone can offer some > advice, it would be appreciated. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Rich Wilkman Senior Quality Assurance Engineer Borland JBuilder Team If you see something that looks like an opinion up there, it's mine and mine alone. Mail sent to me from the newsgroups won't bounce but will be ignored. If I have time, I'll respond, but you have a better chance if you confine your posts to the newsgroups =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID:
<35042317.B5AE3D18@corp.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6dubpt$26t5@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,9f9a24dbf90a2338 X-Google-Attributes: gid1089d0,public From: Rich Wilkman <rwilkman@corp.borland.com> Subject: Re: Need help from a layout expert Date: 1998/03/09 Message-ID: <35042317.B5AE3D18@corp.borland.com> X-Deja-AN: 332320038 Content-Transfer-Encoding: 7bit References: <6dubpt$26t5@forums.borland.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.api