Article View: borland.public.jbuilder.java.swing
Article #1092How do I get at the root pane of JApplet and it's members?
From: Ted Byers
Date: Wed, 24 Mar 2004 20:53
Date: Wed, 24 Mar 2004 20:53
48 lines
2868 bytes
2868 bytes
I have a book on JFV/Swing and it says:
"Swing containers such as JApplet, JFrame, JWindow, JDialog, and
JInternalFrame delegate their duties to the root pane that is represented by
the class JRootPane" and "Because a root pane is made up of a content pane,
layered pane, glass pane and menubar, contents must be added to one of these
root pane members, rather than to the root pane. You can get a reference to
the underlying root pane of a container by using the method getRootPane();"
It is my understanding that I can control wich Swing object is displayed on
top of the others, when there ae overlapping controls, by using the
different panes in the root pane, and also that the glass pane is
specifically for the sort of thing I have been trying to do, in terms of
having an invisible JLabel over top a visible JLabel which has an image.
My problem, at present, is that JBuilder9 doesn't seem to know about the
root pane and its data members, or about the functions rquired to access
them.
I am assuming that I am having trouble withmy mouse cursor is that for some
reason the invisible JLable is underneath the visible one.
The primary problem I am tying to solve is that, of the mouse events for
which I have created handlers, only the click event seems to be called.
Here is the relevant code:
void jLabel2_mousePressed(MouseEvent e) {
showStatus("HotSpotImageTest applet, component jLabel2: mousePressed");
}
void jLabel2_mouseEntered(MouseEvent e) {
jLabel2.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
void jLabel2_mouseExited(MouseEvent e) {
jLabel2.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
jLabel2 is the invisible object, and the mouse_pressed event is called but
there is no evidence that the Mouse_Entered and Mouse_Exited events are
being called. If they are, then the single statement in each has failed
silently.
Any ideas?
Thanks,
Ted
Technical Details
Message-ID:
<4061f46f@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,5588570eabbf8052,start X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2004-03-24 12:55:39 PST From: "Ted Byers" <r.ted.byers@sympatico.ca> Newsgroups: borland.public.jbuilder.java.swing Subject: How do I get at the root pane of JApplet and it's members? Date: Wed, 24 Mar 2004 15:53:48 -0500 Lines: 50 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 65.95.240.180 Message-ID: <4061f46f@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1080161391 65.95.240.180 (24 Mar 2004 12:49:51 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail