Article View: borland.public.jbuilder.java.swing
Article #11976Mouse events, JLayeredPane and GridControl
From: Alex B. Humphreys
Date: Tue, 23 Mar 1999 00:00
Date: Tue, 23 Mar 1999 00:00
21 lines
1500 bytes
1500 bytes
I have a button that I'm causing to appear a layer or two above a cell
of a gridcontrol (using JLayeredPane). The button shows but doesn't
take mouse events -- all mouse events are captured by the GridControl.
I can, however, get the button to hear keyevents. How can I get my
button to hear the mouse?
Here's the relevant code: Thanks --a
Rectangle cell = grid.getCellRect(grid.getSubfocus());
int x = cell.x + grid.getViewport().getViewPosition().x +
grid.getX();
int y = cell.y + grid.getViewport().getViewPosition().y +
grid.getY();
x = x + cell.width;//actually these location things are a little
more weird, but why confuse things here?
y = y + cell.height;//they're weird in order to get them to show
up in the appropriate cell
lookup_button.setBounds(x,y,cell.height,cell.height);
layeredPane.add(lookup_button, 2);
lookup_button.requestFocus();//this allows the button to
immediately capture key events.
Technical Details
Message-ID:
<36F7CCBA.6D1D07C9@sema4.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,56fc9ec58e5972a9,start X-Google-Attributes: gid111d45,public From: "Alex B. Humphreys" <ahumphreys@sema4.com> Subject: Mouse events, JLayeredPane and GridControl Date: 1999/03/23 Message-ID: <36F7CCBA.6D1D07C9@sema4.com> X-Deja-AN: 458039325 Content-Transfer-Encoding: 7bit X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Semaphore, Inc. Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing