[1547] in java-interest

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

Re: java-interest-digest V1 #153

daemon@ATHENA.MIT.EDU (julie melbin)
Thu Sep 7 12:02:39 1995

Date: Thu, 7 Sep 95 08:10:03 EDT
To: java-interest@java.sun.com, java-interest-digest@java.sun.com
From: julie@world.std.com (julie melbin)

At 11:30 PM 9/6/95 -0700, java-interest@java.sun.com wrote:

>From: Nicholas Geh <nik@mailhub.ncb.gov.sg>
>Date: Thu, 7 Sep 1995 10:36:37 +0900 (SDT)
>Subject: Re: The Window of an Applet??
>
>Hi guys,
>
>I tried to do that, but (item.x,item.y) still refers to the origin of the 
>html document rather than the applet. As a result, all my TextAreas are 
>clustered at the top-left corner of the html document, even though they 
>are from different applets within the html document.
>
>> 
>> 
>> ---------- Forwarded message ----------
>> Date: Wed, 06 Sep 95 08:55:27 -0500
>> From: Lin Huang <linh@connectsoft.com>
>> To: Henry Koh Li-Chieh <henrykoh@regent.ncb.gov.sg>
>> Cc: java-interest <java-interest@java.sun.com>
>> Subject: Re: The Window of an Applet??
>> 
>> Hi Henry:
>> 
>> You can try to use Applet.item.parent as the parent to construct the
>> TextAreas, Windows etc, and using item.x and item.y (the origin of Applet)
>> as the start point to position your objects.
>> 
>> Lin
>

Here's what I needed to do to always find the correct location of my applet
window:

    public void paint(Graphics g)
      {
        myAppWindow.updateGeometry(g);
      }

Where the method updateGeometry() for my appwindow dervived thing does
basically this:

    public void updateGeometry(Graphics g)
      { 
        // Find out where the window is in relation
        // to the java browser window
        realX = g.originX;
        realY = g.originY;
      }


Note I don't repaint in this method, I just handle what happens to my window
when the browser main window is scrolled or resized.

Good Luck


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
julie@world.std.com    I have been invisible.

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

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