Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #4494
| From | "A. Bolmarcich" <a..bolmarcich@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: gridLayout doesn't wo |
| Message-ID | <slrngirggl.14c0.aggedor@earl-grey.cloud9.net> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <2e8a0a99-f03d-4526-ae60-0dc869ad1da0@i24g2000prf.googlegroups.co |
| Date | 2011-04-27 15:50 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui On 2008-11-26, heixian@gmail.com <heixian@gmail.com> wrote: > I am new to java.swing and its layout programming. I encounter a > strange problem when I use the boxLayout in a > base panel and gridLayout in each sub panel. > > as you can see, I set the boxLayout in the base panel in vertical > fashion ( setJcontentPane() ). inside each box I use the gridLaout to > addbuttons. There are two boxes in the panel. The first one is for > user, the second one is for company. When you call the initialize() > the UI is built. > > Inside the user box ( setManageUserPanel() ), the gridLayout is set to > (1, 3, 10 ,20) > Inside the company box ( setManageCompanyPanel() ), the gridLayout is > set to (2, 3, 10, 20) > > The problem is in the company box, the buttons are diplay in two rows > and each row has two buttons. > 1--2, > 3--4, > > Should it be in two rows but first row has three buttons and second > row has only one? > 1--2--3, > 4 > > Also here are what I change the gridLayout for the company box, below > are how the button get display > (4, 1, 10, 20) correct > 1--, > 2--, > 3--, > 4--, > > (1, 4, 10, 20) correct > 1--2--3--4 > > (2, 4, 10, 20) NOT RIGHT!!! > 1--2, > 3--4, > > don't what's wrong of my code, the gridLayout doesn't do what it > suppose to do. Please help GridLayout is doing what it is documented to do. According to http://w3.java.ibm.com/java/docs/jdk5.0/api/java/awt/GridLayout.html "When both the number of rows and the number of columns have been set to non-zero values, either by a constructor or by the setRows and setColumns methods, the number of columns specified is ignored. Instead, the number of columns is determined from the specified number or rows and the total number of components in the layout." Components in a (2,3) grid will be arranged in 2 rows. Four components will be arranged in 2 rows of two columns. Components in a (2,4) grid will be arranged the same as in a (2,3) grid. --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next | Find similar
Re: gridLayout doesn't wo "A. Bolmarcich" <a..bolmarcich@THRWHITE.remove-dii-this> - 2011-04-27 15:50 +0000
csiph-web