JDK-5051557 : COMPATIBILITY: JOTB - 3D Blox applet does not function properly.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0,6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2004-05-22
  • Updated: 2005-11-23
  • Resolved: 2005-09-17
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 b53Fixed
Related Reports
Duplicate :  
Description
Tested OS/Browser:  
-----------------      
                    XP-home/ IE6
                    win2000/ IE6
                    winME/   IE5.5

Tested  Build:  
-------------  
                    j2re1.5-b51

(Note: Must use OFF_SWAN machines to reproduce this bug)

Problem: 
-------
The applet loads, but the keys intended to control the applet do not do anything (G,N,M,L). They work fine with MS VM


Steps to reproduce:
------------------
1) Install j2re1.5-b51 into the test system
2) Browse to http://www.javaonthebrain.com
3) Click on applets tab at top of page
4) Click on '3D Blox'
5) Play the game 


The applet does not respond to keyboard commands to interact with
the applet. The keys G, N, M, and L are supposed to move the character (pengium) around, but fail to do anything at all. There is no way to play the game. The problem can not be reproducible with MS VM.


**************************************************************************
The problem also occurs in J2SE 6.0 (tested with build 31)
on win 2000 pro(sp4)/IE6
XP-Home(sp2)/ IE6

Unable to play the applet with the keyboard key.


###@###.### 2005-05-03 21:39:00 GMT



Verified the fix in Mustang-b59 on XP-Home(sp2)/IE6
                                   win 2000 pro(sp4)/IE6

Comments
SUGGESTED FIX ------- Component.java ------- *** /tmp/sccs.CRayyO Thu Sep 1 14:31:34 2005 --- Component.java Thu Sep 1 14:30:55 2005 *************** *** 48,59 **** import java.awt.GraphicsConfiguration; import java.security.AccessController; import java.security.PrivilegedAction; import javax.accessibility.*; import java.lang.ref.*; - import java.util.logging.*; import sun.security.action.GetPropertyAction; import sun.awt.AppContext; import sun.awt.SunToolkit; import sun.awt.ConstrainableGraphics; --- 48,59 ---- import java.awt.GraphicsConfiguration; import java.security.AccessController; import java.security.PrivilegedAction; import javax.accessibility.*; import java.lang.ref.*; import java.util.logging.*; + import java.applet.Applet; import sun.security.action.GetPropertyAction; import sun.awt.AppContext; import sun.awt.SunToolkit; import sun.awt.ConstrainableGraphics; *************** *** 61,70 **** --- 61,71 ---- import sun.awt.SubRegionShowable; import sun.awt.WindowClosingListener; import sun.awt.WindowClosingSupport; import sun.awt.GlobalCursorManager; import sun.awt.CausedFocusEvent; + import sun.awt.EmbeddedFrame; import sun.awt.dnd.SunDropTargetEvent; import sun.awt.im.CompositionArea; import sun.java2d.SunGraphics2D; /** *************** *** 7181,7191 **** public void nextFocus() { nextFocusHelper(); } boolean nextFocusHelper() { ! return postNextFocusHelper(preNextFocusHelper()); } Component preNextFocusHelper() { Container rootAncestor = getFocusCycleRootAncestor(); Component comp = this; --- 7182,7196 ---- public void nextFocus() { nextFocusHelper(); } boolean nextFocusHelper() { ! Component toFocus = preNextFocusHelper(); ! if (isFocusOwner() && toFocus == this) { ! return false; ! } ! return postNextFocusHelper(toFocus); } Component preNextFocusHelper() { Container rootAncestor = getFocusCycleRootAncestor(); Component comp = this; *************** *** 7202,7211 **** --- 7207,7222 ---- rootAncestor.getFocusTraversalPolicy(); Component toFocus = policy.getComponentAfter(rootAncestor, comp); if (toFocus == null) { toFocus = policy.getDefaultComponent(rootAncestor); } + if (toFocus == null) { + Applet applet = EmbeddedFrame.getAppletIfAncestorOf(this); + if (applet != null) { + toFocus = applet; + } + } return toFocus; } return null; } ------- EmbeddedFrame.java ------- *** /tmp/sccs.r9ayGO Thu Sep 1 14:31:35 2005 --- EmbeddedFrame.java Thu Sep 1 14:27:57 2005 *************** *** 19,28 **** --- 19,30 ---- import java.lang.reflect.Field; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; import java.util.Set; import java.awt.AWTKeyStroke; + import java.applet.Applet; + import sun.applet.AppletPanel; /** * A generic container used for embedding Java components, usually applets. * An EmbeddedFrame has two related uses: * *************** *** 487,496 **** --- 489,517 ---- public void toBack() {} public abstract void registerAccelerator(AWTKeyStroke stroke); public abstract void unregisterAccelerator(AWTKeyStroke stroke); + /* + * Checks if the component is in an EmbeddedFrame. If so, + * returns the applet found in the hierarchy or null if + * not found. + * @return the parent applet or {@ null} + * @since JDK1.6 + */ + public static Applet getAppletIfAncestorOf(Component comp) { + Container parent = comp.getParent(); + Applet applet = null; + while (parent != null && !(parent instanceof EmbeddedFrame)) { + if (parent instanceof Applet) { + applet = (Applet)parent; + } + parent = parent.getParent(); + } + return parent == null ? null : applet; + } + private static class NullEmbeddedFramePeer extends NullComponentPeer implements FramePeer { public void setTitle(String title) {} public void setIconImage(Image im) {} public void setMenuBar(MenuBar mb) {}
01-09-2005

EVALUATION Name: osR10079 Date: 05/23/2004 The cause of the problem is that Applet itself doesn't get focus (with beta1 embedded frame receives focus instead). The applet works fine when I add setFocusable(true) in its ctor or init(). I think this is known imcompatibility introduced by focus rearchitecture (made in 1.4), although we need to verify if the problem is reproducible with 1.4. ###@###.### 2004-05-24 ====================================================================== Name: ssR10077 Date: 05/24/2004 Probem is reproducible with JDK1.4.2 ###@###.### 2004-05-24 ====================================================================== 3D Blox game applet on javaonthebrain.com exhibit similar focus issue discussed in 5051558. Please see this bug report for evaluation. ###@###.### 2004-06-22 When user clicks "Play" button in the applet all the buttons disappear and focus apparently goes to the embedded frame whereas before focus rearchitecture it went to the canvas. ###@###.### 2005-07-01 08:14:23 GMT
01-07-2005