JDK-4806274 : RequestFocus does not bring focus to component in Netscape 7 on Solaris
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.0
  • Priority: P1
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2003-01-22
  • Updated: 2003-12-30
  • Resolved: 2003-10-24
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.
5.0 betaFixed
Related Reports
Relates :  
Running Netscape 7.0 on Solaris 8. 

Customer  has an applet with some textfileds and buttons. The code has RequestFocus() call to set the focus on one of the text fields when the applet gets loaded. The focus is not getting set to the text field when using Netscape 7 on Solaris 8.

However, the same code works fine on Netscape 7 on Windows and Netscape 6.x on Solaris.

====================Test Code================

import java.awt.*;
import java.applet.*;
import java.awt.event.*;

//<TITLE>Tabbing Test</TITLE>
//<APPLET CODE="Sample.class" CODEBASE="."  id=MyApplet name=MyApplet WIDTH=400 //HEIGHT=400 >



public class Sample extends Applet implements ActionListener, FocusListener
        TextField txtname,txtpass;
        Label lblname, lblpass;
        Button btnlogin, btncancel;
        String msg="";

        public void init()
                lblname = new Label("Name : ", Label.RIGHT);
                lblpass = new Label("Password :", Label.RIGHT);
                txtname = new TextField(12);
                txtpass = new TextField(8);

                GridLayout grid = new GridLayout(5,2);

                setFont(new Font("Helvetica", Font.PLAIN, 14));

                btnlogin = new Button("Login");
                btncancel = new Button("Password");



 public void start()
        public void actionPerformed(ActionEvent ae)
                Label x = new Label ("Clicked");
                String str = ae.getActionCommand();
                        msg = "ButtonClicked : Yes";
                else if(str.equals("No"))
                        msg = "ButtonClicked : No";

        public void paint(Graphics g)
                g.drawString("Name: " + txtname.getText(),6,60);
                g.drawString("selected Text: " + txtname.getSelectedText(),6,80)
                g.drawString("Password :" + txtpass.getText(),6,100);

        public void focusGained(FocusEvent fe)
                Component c= fe.getComponent();
                if (c instanceof TextField)


        public void focusLost(FocusEvent fe)
                Component c= fe.getComponent();
                if (c instanceof TextField)


CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta FIXED IN: tiger-beta INTEGRATED IN: tiger-beta

WORK AROUND A better workaround is in the attachment - workaround.zip. It contains a modified Sample.java and its class. ###@###.### 2003-06-26 -------------------------------------- Add the components in the start() method of the applet. This however may not always be feasible as customer has to go back and change a lot of code that was working fine in Netscape6 & IE . Also, various other bugs were fixed in Netscape7 which forces them to use 7.0 as their recommended Netscape clien

EVALUATION Reporter, can you confirm Netscape 6.x works fine? I just tried mozilla0.9.4 and can reproduce the problem on it. Netscape 6.x is based on mozilla0.9.4. So I think Netscape 6.x should not work. ###@###.### 2003-02-25 I just discussed with Robin. Seems this is not a bug in Browser. It's caused by focus problem of the java plugin. XiaoBin, could you please take a look at this bug and assign to the appropriate person. Thanks ###@###.### 2003-03-05 This is also a focus related bug. and reporter's statement "netscape6 works fine on Solaris" is wrong. the fact is that all mozilla+gtk1.x based browser has this problem on unix, netscape6.x is not exclusive. When mouse enters into applet, mozilla passes focus to applet, this is all mozilla can do, at that time RequestFocus should work inside applet, but that does not work, that is the problem. The reason why sunmozilla121 works is because sunmozilla121 is using gtk2, which is using different focus management method. Why NS 4.x works is becasue it manages both browser and its internal JVM. Windows's focus management is a totally different story othen than XWindow and it's graphics toolkits. Xiaobin, sorry to bother you again on this to work with java team, can you help to find suitable person to own this? thanks a lot. ###@###.### 2003-03-05 The applet fails to get the focus even using "appletviewer". Reassign to AWT for further investigation. ###@###.### 2003-03-05 Mozilla: Sun Mozilla 1.1 Sun Mozilla 1.2.1: 1.4.2b17, 1.4.1b21, 1.4.1_01, 1.4.1_02 - if started with mouse outside of applet it requires one additional click of mouse after moving it inside. TextField all the time looks like it has focus(wrong). If I press Tab when mouse is outside I can make URL field to be focused. After that, if I move mouse inside of Applet and tab through items. I can make text field focused at the same time as URL field remains focused. So, we have two input focus owners. - if started with mouse inside doesn't require anything - focus works. This happens the same with all the configuration I listed. I am pretty much sure it is the problem with Mozilla - in normal applications focus doesn't get affected by mouse position unless you are in a point-to-focus mode. ###@###.### 2003-03-05 The appletviewer I used in 1.2.2. The latest appletviewer does not have this problem. ###@###.### 2003-03-05 ----------------------------------- Found a workaround to this problem. Basically, the workaound is to use the setForcusTraversalKeysEnabled api instead of requestFocus. I've included a modified Sample.java and its class file in the attachment. ###@###.### 2003-06-16 ----------------------------------- Escalation has been closed since customer has accepted my workaround. At this point, there's no plan on integrating a fix into 1.4.1_0x update release. ###@###.### 2003-06-26 Fixed by the fixes for Fri, 3 Oct 2003 Fixed 4907325: XEmbed should be implemented for Motif toolkit Thu, 31 Jul 2003 The last part of the fix for RFE 4849238: Add XEmbed support to AWT Itseems the TAB issue is still there. I have tested the original testcase with 'Solaris+NS7' as well as 'appletviewer' using tiger-beta(b32). After loading the applet, the first(top) textbox shows up in cyan background and I am able to type text in to it, but TAB is still not working. Am I missing something here? ###@###.### 2003-12-30 Name: dmR10075 Date: 12/30/2003 I verified previously and now - Tabbing works fine on Linux with XAWT and Motif toolkits. Note that you must use XEmbed-enabled browser, it is Mozilla 1.5 on Linux or some of the latest builds of Mozilla 1.4 on Solaris(don't know which one though). As far as I know NS7 doesn't support XEmbed. ###@###.### 2003-12-30 ======================================================================