The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Grid Layout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply locked New topic

Grid Layout

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
this is a question on gidlayout.
There is a gridlayout (2,2). all the four grids are filled up. if i add a new componenent which row will/column it occupy?
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Column 2, row 2. However some of the other buttons will be repositioned:
Button 1: row 1 col 1
Button 2: row 1 col 2
Button 3: row 1 col 3
Button 4: row 2 col 1
Button 5: row 2 col 2
Whenever both number of columns and number of rows are set by the constructor, the number of columns is actually completely ignored, and instread is determined by how many componenets are added. You can read about it here.

"I'm not back." - Bill Harding, Twister
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
And please don't post the same question twice in two identical threads, as it's a waste of time to answer the question in one thread when it's already been answered in the other.
I agree. Here's the link:
subject: Grid Layout
It's not a secret anymore!