On 27 Oct 1998, Juergen Kreileder wrote:
John> public void paint(Graphics g)
> John> {
> John> super.paint(g);
> John> g.drawString(s,5,40);
> John> g.drawString(s2,5,80);
> John> g.drawString(s3,5,120);
> John> }
> John> }
>
> When working with frames you have to honor the frame's insets.
> The insets include the frames border size, the title bar size,
> the menu bar size, the warning bar size.
> So it's no bug, your code is not 100% portable ;-)
>
> Have you tried to use something like:
>
> Insets insets = getInsets();
> int top = insets.top;
> int left = insets.left;
> super.paint(g);
> g.drawString(s,5 + left ,40 + top);
> g.drawString(s2,5 + left ,80 + top);
> g.drawString(s3,5 + left ,120 + top);
Then let's blame Peter van der Linden whose book, Just Java, doesn't
mention insets in the index nor, so far as I can see scanning chapters, in
any code examples.
I have seen insets mentioned in the JDK documentation, but only in the
context of a ScrollPane.
Seems I've some code to change. Sob.
Cheers
John Summerfield
http://os2.ami.com.au/os2/ for OS/2 support.
Configuration, networking, combined IBM ftpsites index.