From a1117d31b6e286fb36264f36827c1cd7efb41373 Mon Sep 17 00:00:00 2001 From: Dmitry Cherepanov Date: Thu, 19 Feb 2009 14:10:19 +0300 Subject: [PATCH] 6806224: PIT : Getting java.lang.NullPointerException while opening Filedialog Reviewed-by: art, dav --- .../classes/sun/awt/X11/XComponentPeer.java | 6 +--- .../classes/sun/awt/X11/XFileDialogPeer.java | 30 ++++++++----------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java index 8a14cfe5f0f..46c4a8768f0 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java @@ -166,7 +166,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget enableLog.log(Level.FINE, "Initial enable state: {0}", new Object[] {Boolean.valueOf(enabled)}); if (target.isVisible()) { - show(); + setVisible(true); } } @@ -496,10 +496,6 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget xSetVisible(b); } - public void show() { - setVisible(true); - } - public void hide() { setVisible(false); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java index 0675847af79..0b8085e759d 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java @@ -739,7 +739,17 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe this.filter = filter; } - public void show() { + + public void dispose() { + FileDialog fd = (FileDialog)fileDialog; + if (fd != null) { + fd.removeAll(); + } + super.dispose(); + } + + // 03/02/2005 b5097243 Pressing 'ESC' on a file dlg does not dispose the dlg on Xtoolkit + public void setVisible(boolean b){ if (fileDialog == null) { init((FileDialog)target); } @@ -754,34 +764,20 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe setFile(savedFile); } - super.show(); - selectionField.requestFocusInWindow(); - } - - public void dispose() { - FileDialog fd = (FileDialog)fileDialog; - if (fd != null) { - fd.removeAll(); - } - super.dispose(); - } - - // 03/02/2005 b5097243 Pressing 'ESC' on a file dlg does not dispose the dlg on Xtoolkit - public void setVisible(boolean b){ super.setVisible(b); if (b == true){ // See 6240074 for more information XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer(); choicePeer.addXChoicePeerListener(this); - KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this); }else{ // See 6240074 for more information XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer(); choicePeer.removeXChoicePeerListener(); - KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this); } + + selectionField.requestFocusInWindow(); } /*