GridLayout in applets


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: GridLayout in applets

  1. #1
    Join Date
    Mar 2003
    Posts
    9

    GridLayout in applets

    I'm having a slight bit of trouble deciphering what the parameters in "setLayout(new GridLayout(x,y));" do.

    I've mostly figured that 'x' is the number maximum number of objects in a column (I think), but I can't figure out what exactly the 'y' variable specifies.

    Anyone know offhand?

  2. #2
    Join Date
    Feb 2004
    Posts
    8
    first no is number of rows, second is number of columns


    if you want

    button button
    button button
    ...
    ...

    then use GridLayout(0,2)



    if you want

    button button button ... ...
    button button button ... ...

    then use GridLayout(2,0)

    best thing to do is try both and see what difference it makes so that the layout appears how you want

  3. #3
    Join Date
    Feb 2004
    Posts
    808
    Originally posted by boroski
    first no is number of rows, second is number of columns


    if you want

    button button
    button button
    ...
    ...

    then use GridLayout(0,2)



    if you want

    button button button ... ...
    button button button ... ...

    then use GridLayout(2,0)

    best thing to do is try both and see what difference it makes so that the layout appears how you want
    i take it that 0 means continue forever? is that what your dots mean?
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

  4. #4
    Join Date
    Feb 2004
    Posts
    8
    yeah the dots mean carry on ie there is no bounds (which is coded with 0)

  5. #5
    Join Date
    Mar 2003
    Posts
    9
    quick clarification

    If I do GridLayout(2,2), does that mean I can only use 4 buttons, in a

    button, button
    button, button

    format?

  6. #6
    Join Date
    Feb 2004
    Posts
    808
    try it

    either:

    the 5th addition will overwrite teh first
    or an exception will be thrown
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center