Hey,
For some reason when I did a CVS diff to create the patch for these
changes, the change I made to BasicPopupMenuUI.java wasn't included. I
only realized this afterwards. Again, this change was due to the mauve
test I created (getPopUPMenu.java) that I have already committed. Below
is the changelog entry for this change. When someone approves this
patch, I'll combine the two changelog entries when I commit it. Thanks.
Here's the changelog entry:
2006-06-21 Tania Bento <[EMAIL PROTECTED]>
*javax/swing/plaf/basic/BasicPopupMenu.UI.java
(popupMenuWillBecomeVisible): Component Listener should only
be added to the root container if the root container is not
null. This avoids a null pointer exception.
Cheers,
Tania
On Tue, 2006-06-20 at 16:53 -0400, Tania Bento wrote:
> Sorry, forgot to mention that these specific changes are due to the
> getPopUpMenu.java mauve test I just committed.
>
> Tania
>
> On Tue, 2006-06-20 at 16:52 -0400, Tania Bento wrote:
> > Hey,
> >
> > I have written a test for all of JMenu's constructors and found many
> > constructor regressions. This patches fixes all of them. Could someone
> > please approve this patch so that I may commit it. Thanks.
> >
> > Here's the Changelog entry:
> >
> > 2006-06-20 Tania Bento <[EMAIL PROTECTED]>
> >
> > * javax/swing/JMenu.java
> > Changed instantiation of popupMenu to null.
> > (JMenu): Instantiated popupMenu to new JPopupMenu.
> > (JMenu): Instantiated popupMenu to new JPopupMenu.
> > (add): Changed popupMenu to getPopupMenu().
> > (add): Changed popupMenu to getPopupMenu().
> > (add): Changed popupMenu to getPopupMenu().
> > (add): Changed popupMenu to getPopupMenu().
> > (remove): Changed popupMenu to getPopupMenu().
> > (remove): Changed popupMenu to getPopupMenu().
> > (insert): Changed popupMenu to getPopupMenu().
> > (setSelectedHelper): Changed popupMenu to getPopupMenu().
> > (isPopupMenuVisible): Changed popupMenu to getPopupMenu().
> > (setPopupMenuVisible): Changed popupMenu to getPopupMenu().
> > (getMenuComponentCount): Changed popupMenu to getPopupMenu().
> > (getMenuComponents): Changed popupMenu to getPopupMenu().
> > (getPopupMenu): Check first if popupMenu is null and if so,
> > instantiate it to a new JPopupMenu and set the invoker.
> >
>
>
Index: javax/swing/plaf/basic/BasicPopupMenuUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java,v
retrieving revision 1.18
diff -u -r1.18 BasicPopupMenuUI.java
--- javax/swing/plaf/basic/BasicPopupMenuUI.java 17 Apr 2006 07:41:05 -0000 1.18
+++ javax/swing/plaf/basic/BasicPopupMenuUI.java 21 Jun 2006 13:30:31 -0000
@@ -278,9 +278,10 @@
// Adds topWindowListener to top-level window to listener to
// ComponentEvents fired by it. We need to cancel this popup menu
// if topWindow to which this popup belongs was resized or moved.
- Component invoker = popupMenu.getInvoker();
+ Component invoker = popupMenu.getInvoker();
Component rootContainer = SwingUtilities.getRoot(invoker);
- rootContainer.addComponentListener(topWindowListener);
+ if (rootContainer != null)
+ rootContainer.addComponentListener(topWindowListener);
// if this popup menu is a free floating popup menu,
// then by default its first element should be always selected when