Re: Draggable window only works in MS JVM, and not Sun?
- From: "Andrey Kuznetsov" <spam0@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 28 Dec 2005 16:47:02 +0100
> Thanks Andrey for your response. Unfortunately, I am using Java 1.1
> (and need to), is there any equivalent for non-Swing?
something like this:
//since you want to use it only in event handler
//I assume that component was alredy realized - so no checking here
public static Point getLocationOnScreen(Component c) {
Point p = c.getLocation();
int x = p.x;
int y = p.y;
Container parent = c.getParent();
while(parent != null) {
p = parent.getLocation();
x += p.x;
y += p.y;
parent = parent.getParent();
}
return new Point(x, y);
}
public static Point convertPointToScreen(Point p, Container c) {
Point p0 = getLocationOnScreen(c);
p0.x += p.x;
p0.y += p.y;
return p0;
}
--
Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
.
- Follow-Ups:
- Re: Draggable window only works in MS JVM, and not Sun?
- From: PilotYid
- Re: Draggable window only works in MS JVM, and not Sun?
- References:
- Draggable window only works in MS JVM, and not Sun?
- From: PilotYid
- Re: Draggable window only works in MS JVM, and not Sun?
- From: Andrey Kuznetsov
- Re: Draggable window only works in MS JVM, and not Sun?
- From: PilotYid
- Draggable window only works in MS JVM, and not Sun?
- Prev by Date: Re: Draggable window only works in MS JVM, and not Sun?
- Next by Date: Re: Draggable window only works in MS JVM, and not Sun?
- Previous by thread: Re: Draggable window only works in MS JVM, and not Sun?
- Next by thread: Re: Draggable window only works in MS JVM, and not Sun?
- Index(es):
Relevant Pages
|