[4942] in java-interest

home help back first fref pref prev next nref lref last post

RE: Can anyone explain goofiness in GridBagLayout?

daemon@ATHENA.MIT.EDU (Cay Horstmann)
Tue Jan 23 15:34:36 1996

From: Cay Horstmann <horstman@jupiter.SJSU.EDU>
To: "'java-interest@java.sun.com'" <java-interest@java.sun.com>
Date: Tue, 23 Jan 1996 10:14:28 -0800

Thanks. I understand the difference between a grid and a grid bag. In a grid, you can't merge cells. 

Nevertheless, the grid bag does have an underlying grid--just look at the source. It computes the total number of rows and columns needed.

I don't understand how that source could act differently on different machines. It is written in Java.

Cay
horstman@cs.sjsu.edu


Cay Horstmann (horstman@cs.sjsu.edu)


   I am trying to understand GridBagLayout. The idea is simple. You make
   a grid. You then merge adjacent cells. Just like tables in Word or
   WordPerfect. 

   Then the craziness sets in. Why don't I just tell the grid bag layout
   object how many rows and columns my grid has? I mean why be coy about
   it? 

Anna von Klopp (a.von.klopp@bangor.ac.uk)

Because that's what it hasn't. If you have rows and cols, use the
GridLayout. The GridBagLayout is "handy" if you have 

Component 1

Comp   Comp
onen   onen
t 2    t 3

Component 4

for instance. Or if your display alternates between a 2X2 and a 2X1
pattern. This is not to say that I am particular fond of it, just that
it might not be what you want. 

I'm not expressing positive sentiments about the GridBagLayout by
this. You can see it in use at 

http://www.linguistics.bangor.ac.uk/java/lt/LingTutor.java 

(with a natural language parser to boot). 


   I tried the much simpler scheme of setting x and y, width and height
   to their actual values rather than having the grid bag layout recover
   them from my hints, and it seems to work just fine. It is easier on
   me, it is easier on the layout manager, so what is the use of the
   scheme explained in the docs?

>From what I've gathered, this doesn't work between machines. We did it
for the alpha java version of the applet above. 

Ana von Klopp





-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post