[2228] in java-interest
Re: JDK : layout : is something wrong ?
daemon@ATHENA.MIT.EDU (dufourd@enst.enst.fr)
Wed Sep 27 07:15:08 1995
From: dufourd@enst.enst.fr
To: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
Cc: dufourd@enst.enst.fr, java-interest@java.Eng.Sun.COM
In-Reply-To: Your message of "Tue, 26 Sep 95 13:03:28 PST."
<Roam.1.2.812145808.1928.avh@acorn>
Date: Wed, 27 Sep 95 09:26:29 +0100
>> I cannot get anything deterministic out of the various
>> layoutManagers. Is something wrong, or is it just me ?
>
>I hope it is just you. If you have a particular problem you'll have
>to attached a simple example. Random muttering doesn't help.
I was just trying to ask "open" questions, as opposed to the "closed"
assertion I had made about exceptions. And I do not like to throw a bunch
of code at someone's head and say : sort it out! But you asked... :-)
The following code is a "simplified" version of the applet I am migrating.
All canvas are replaced with labels. This scaled down version, when compiled
and viewed by a DecAlpha machine used as X terminal on a Solaris 5.4
SparcCenter 2000 has the following problem : the huge label between the
start and stop comments disappears (should be in the top middle and right).
Only the right half of a small s can be seen.
In the original applet, when I change all LayoutManagers to FlowLayout,
I do not get a single row of elements either. When I change all
LayoutManagers to null (absolute placement?), everything disappears.
When I change the order of the adds, or the layouts, non-deterministic
changes happen : some elements disappear (even after a repaint!), some
are truncated. For my previous applet, I just tried many relative
placements until one worked (miraculously).
JC
--------------8<------------------
import java.awt.*;
import java.applet.*;
public class h extends Applet {
Label MT ;
public void init() {
setFont( new Font( "Helvetica", Font.PLAIN, 14 ));
setLayout( new BorderLayout());
Panel leftTop = new Panel();
leftTop.setLayout( new BorderLayout());
leftTop.add( "North", new Label("MOSTransistor"));
leftTop.add( "South", new Label("vcommands"));
// start
MT = new Label("mostrans");
MT.setFont( new Font( "helvetica", Font.BOLD, 48 ));
//stop
Panel top = new Panel();
top.setLayout( new BorderLayout());
top.add( "West", leftTop );
top.add( "East", MT );
add( "North", top );
Panel viewLine = new Panel();
Panel rightViewLine = new Panel();
rightViewLine.setLayout( new BorderLayout());
viewLine.add( "Top", new Label("TopView") );
viewLine.add( "RVL", rightViewLine );
rightViewLine.add( "North", new Label("Cut"));
rightViewLine.add( "Center", new Label("sideview"));
rightViewLine.add( "South", new Label("topview"));
add( "Center", viewLine );
}
}
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com