🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #1025

Re: Open Frame at mouse position

#1025
From: Gillmer J. Derge [TeamB]
Date: Mon, 29 Apr 2002 15:24
18 lines
1701 bytes
"Alex Terehoff" <aterehoff@hotmail.com> wrote in message
news:3ccc8527_1@dnews...
> I am trying to open a frame at the position of the button clicked. I am
> taking the mouse position using
> e.getX() and e.getY() on mousePressed where e is a MouseEvent and trying
to
> assing the value of x and y when calling frame's setLocation() method but
> still the frame is opened at the desired location/position.

I think the coordinates from the mouse event need to be converted to screen
coordinates before you set the frame's location.  Try something like this:

    Component source = (Component)event.getSource();
    frame.setLocation(SwingUtilities.convertPointToScreen(event.getPoint(),
component));

--
Gillmer J. Derge [TeamB]
Technical Details
Message-ID: <3ccd659c_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!195.40.4.120.MISMATCH!easynet-quince!easynet.net!out.nntp.be!propagator2-SanJose!propagator-SanJose!in.nntp.be!newsfeed01.tsnz.net!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3ccc8527_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,224108dd667f573f
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2002-04-29 08:28:51 PST
From: "Gillmer J. Derge [TeamB]" <spam@gillmerderge.com>
Newsgroups: borland.public.jbuilder.java.api
References: <3ccc8527_1@dnews>
Subject: Re: Open Frame at mouse position
Date: Mon, 29 Apr 2002 11:24:12 -0400
Lines: 21
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 24.58.144.76
Message-ID: <3ccd659c_2@dnews>
X-Trace: dnews 1020093852 24.58.144.76 (29 Apr 2002 08:24:12 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!195.40.4.120.MISMATCH!easynet-quince!easynet.net!out.nntp.be!propagator2-SanJose!propagator-SanJose!in.nntp.be!newsfeed01.tsnz.net!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnews