JDK-6357191 : Drop-down combo box problem at an applet
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-11-30
  • Updated: 2011-01-19
  • Resolved: 2006-02-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b71Fixed
Related Reports
Duplicate :  
Relates :  
Description
The combo box at the following link doesn't work with 1.6.0-rc-b61 build.
http://java.sun.com/docs/books/tutorial/sound/SoundApplet.html
The drop-down box wasn't opened when the field was clicked. And here is the message from the java console box.

Java Plug-in 1.6.0-rc
Using JRE version 1.6.0-rc Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\dtftest
network: Loading user-defined proxy configuration ...
network: Done.
network: Loading proxy configuration from Internet Explorer ...
network: Done.
network: Loading manual proxy configuration ...
network: Convert proxy bypass list to regular expression: 
network:     scaweb1.sfbay.sun.com:8080 --> SCAWEB1.SFBAY.SUN.COM:8080
network: Done.
network: Proxy Configuration: Manual Configuration
     Proxy: http=scaweb1.sfbay.sun.com:8080,https=scaweb1.sfbay.sun.com:8080,ftp=scaweb1.sfbay.sun.com:8080
     Proxy Overrides: scaweb1.sfbay.sun.com:8080


----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
p:   reload proxy configuration
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

basic: Registered modality listener
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@133796, refcount=1
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@1632c2d
basic: Loading applet ...
basic: Initializing applet ...
basic: Starting applet ...
network: Connecting http://java.sun.com/docs/books/tutorial/sound/example-1dot2/playing.jar with proxy=HTTP @ scaweb1.sfbay.sun.com/129.145.155.90:8080
network: Connecting http://java.sun.com/docs/books/tutorial/sound/example-1dot2/playing.jar with cookie "SUN_ID=192.18.42.11:295041124920259; s_cc=true; s_sq"
network: Downloading resource: http://java.sun.com/docs/books/tutorial/sound/example-1dot2/playing.jar
	Content-Length: 558,131
	Content-Encoding: null
basic: Loaded audio clip: http://java.sun.com/docs/books/tutorial/sound/example-1dot2/spacemusic.au
basic: Loaded audio clip: 

http://java.sun.com/docs/books/tutorial/sound/example-1dot2/bottle-open.wav
basic: Loaded audio clip: http://java.sun.com/docs/books/tutorial/sound/example-1dot2/jungle.rmf
basic: Loaded audio clip: http://java.sun.com/docs/books/tutorial/sound/example-1dot2/flute+hrn+mrmba.aif
basic: Loaded audio clip: http://java.sun.com/docs/books/tutorial/sound/example-1dot2/trippygaia1.mid
Exception in thread "Thread-10" java.lang.NullPointerException
	at java.util.Hashtable.put(Unknown Source)
	at AppletSoundList.putClip(AppletSoundList.java:27)
	at AppletSoundLoader.run(AppletSoundLoader.java:25)

Comments
SUGGESTED FIX AWT changes ============ ------- awt_Frame.h ------- *** /tmp/sccs.Ewa4dd Fri Dec 9 14:56:43 2005 --- awt_Frame.h Fri Dec 9 13:45:09 2005 *************** *** 47,56 **** --- 47,59 ---- static AwtFrame* Create(jobject self, jobject parent); /* Returns whether this frame is embedded in an external native frame. */ INLINE BOOL IsEmbeddedFrame() { return m_isEmbedded; } + /* Confirms that EmbeddedFrame is currently requesting activation */ + INLINE BOOL IsEmbeddedFrameActivationRequest() { return m_isEmbeddedFrameActivationRequest; } + /* Returns whether this window is in iconified state. */ INLINE BOOL isIconic() { return m_iconic; } INLINE void setIconic(BOOL b) { m_iconic = b; } /* Returns whether this window is in zoomed state. */ ------- awt_Window.cpp ------- *** /tmp/sccs._Ga4ld Fri Dec 9 14:56:44 2005 --- awt_Window.cpp Fri Dec 9 13:47:24 2005 *************** *** 246,257 **** LRESULT CALLBACK AwtWindow::CBTFilter(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode == HCBT_ACTIVATE || nCode == HCBT_SETFOCUS) { AwtComponent *comp = AwtComponent::GetComponent((HWND)wParam); ! if (comp != NULL && comp->IsTopLevel() && !((AwtWindow*)comp)->IsFocusableWindow()) { ! return 1; } } return ::CallNextHookEx(AwtWindow::ms_hCBTFilter, nCode, wParam, lParam); } --- 246,264 ---- LRESULT CALLBACK AwtWindow::CBTFilter(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode == HCBT_ACTIVATE || nCode == HCBT_SETFOCUS) { AwtComponent *comp = AwtComponent::GetComponent((HWND)wParam); ! ! if (comp != NULL && comp->IsTopLevel()) { ! AwtWindow* win = (AwtWindow*)comp; ! ! if (!win->IsFocusableWindow() || ! (win->IsEmbeddedFrame() && !((AwtFrame*)win)->IsEmbeddedFrameActivationRequest())) ! { ! return 1; ! } } } return ::CallNextHookEx(AwtWindow::ms_hCBTFilter, nCode, wParam, lParam); } deployment changes ================== ------- awt_Window.cpp ------- *** /tmp/sccs._Ga4ld Fri Dec 9 14:56:44 2005 --- awt_Window.cpp Fri Dec 9 13:47:24 2005 *************** *** 246,257 **** LRESULT CALLBACK AwtWindow::CBTFilter(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode == HCBT_ACTIVATE || nCode == HCBT_SETFOCUS) { AwtComponent *comp = AwtComponent::GetComponent((HWND)wParam); ! if (comp != NULL && comp->IsTopLevel() && !((AwtWindow*)comp)->IsFocusableWindow()) { ! return 1; } } return ::CallNextHookEx(AwtWindow::ms_hCBTFilter, nCode, wParam, lParam); } --- 246,264 ---- LRESULT CALLBACK AwtWindow::CBTFilter(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode == HCBT_ACTIVATE || nCode == HCBT_SETFOCUS) { AwtComponent *comp = AwtComponent::GetComponent((HWND)wParam); ! ! if (comp != NULL && comp->IsTopLevel()) { ! AwtWindow* win = (AwtWindow*)comp; ! ! if (!win->IsFocusableWindow() || ! (win->IsEmbeddedFrame() && !((AwtFrame*)win)->IsEmbeddedFrameActivationRequest())) ! { ! return 1; ! } } } return ::CallNextHookEx(AwtWindow::ms_hCBTFilter, nCode, wParam, lParam); } ------- WNetscapeEmbeddedFrame.java ------- *** /tmp/sccs.vFaGHd Tue Jan 17 16:08:15 2006 --- WNetscapeEmbeddedFrame.java Tue Jan 17 16:03:31 2006 *************** *** 49,82 **** public void setJavaObject(WNetscapePluginObject obj) { this.obj = obj; } - /** - * <p> Set the focus on the embedded frame. This is a hack to make Swing - * focus mechanism works inside Java Plug-in. - * </p> - */ - public void requestFocus() - { - WindowEvent evt = new WindowEvent(this, WindowEvent.WINDOW_ACTIVATED); - DeployAWTUtil.postEvent(this, evt); - - if (obj != null) - { - Component c = (Component) obj.getJavaObject(); - - if (c != null) { - c.requestFocus(); - } - } - else - { - super.requestFocus(); - } - } - public void windowActivated(WindowEvent e) {} public void windowClosed(WindowEvent e) {} public void windowClosing(WindowEvent e) { try --- 49,58 ---- ------- WNetscapePluginObject.java ------- *** /tmp/sccs.QqaWvd Tue Jan 17 16:08:14 2006 --- WNetscapePluginObject.java Tue Jan 17 16:03:07 2006 *************** *** 534,544 **** * focus mechanism works inside Java Plug-in. * </p> */ void setFocus() { if (frame != null) ! frame.requestFocus(); } /** * <p> Set the embedded frame size. This method is called only when the WIDTH * and HEIGHT in the EMBED tag are specified using relative dimension (%). --- 534,544 ---- * focus mechanism works inside Java Plug-in. * </p> */ void setFocus() { if (frame != null) ! frame.synthesizeWindowActivation(true); } /** * <p> Set the embedded frame size. This method is called only when the WIDTH * and HEIGHT in the EMBED tag are specified using relative dimension (%).
25-01-2006

EVALUATION The problem is as follows. There's a bug 4922092 that was resolved for IE. The core of the fix is that plugin doesn't send focus events (like WINDOW_ACTIVATED) to EmbeddedFrame but instead it uses special method - EmbeddedFrame.synthesizeWindowActivation() - to activate EmbeddedFrame correctly. Sending focus events directly can result in breaking of the focus events order. This is exactly what's happining in this bug. Wrong focus events order causes NPE to be thrown. To resolve the issue plugin team should implement the same fix as in 4922092 for Mozilla as well as for IE. One more issue is that JCombobox gets immediately closed just being opened. This is because of redundant (from AWT's point of view) native focus events sent by Windows to EmbeddedFrame. AWT implemented its own side of the fix (for 4922092) to eliminate this redundant native events in case of IE. Now this fix should be changed a bit (in AWT code) to resolve this problem for Mozilla as well. So the fix must include both Plugin and AWT changes.
09-12-2005

EVALUATION Attached is the applet corrected.
05-12-2005

EVALUATION The exception described in the Comments section is the same as in 6315094. The reason is that WINDOW_GAINED_FOCUS comes before WINDOW_LOST_FOCUS that is wrong order.
05-12-2005