JDK-5048287 : The focus border in Advance tab in JCP is not changed when tab key is pressed.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-05-17
  • Updated: 2004-05-18
  • Resolved: 2004-05-18
Related Reports
Duplicate :  
Description
Bug Description:
----------------
The Focus border in Advance tab in JavaControlPanel is not shifted when tab key is pressed.

JDK-Info:
--------
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

System-Info:
------------
OS Name	Microsoft Windows XP Home Edition
Version	5.1.2600 Service Pack 1 Build 2600
OS Manufacturer	Microsoft Corporation
System Name	SURESHCHANDAR
System Manufacturer	INTEL_
System Model	D845GBV2
System Type	X86-based PC
Processor	x86 Family 15 Model 2 Stepping 7 GenuineIntel ~2400 Mhz
BIOS Version/Date	Intel Corp. RG84510A.86A.0019.P11.0210211745, 10/21/2002
SMBIOS Version	2.3
Windows Directory	C:\WINDOWS
System Directory	C:\WINDOWS\System32
Boot Device	\Device\HarddiskVolume1
Locale	United States
Hardware Abstraction Layer	Version = "5.1.2600.1106 (xpsp1.020828-1920)"
User Name	SURESHCHANDAR\suresh
Time Zone	India Standard Time
Total Physical Memory	512.00 MB
Available Physical Memory	304.43 MB
Total Virtual Memory	1.72 GB
Available Virtual Memory	1.15 GB
Page File Space	1.22 GB
Page File	C:\pagefile.sys

Steps to Reproduce:
-------------------
1. Install jre1.5.0 b51 in Testing Machine
2. Launch Java Application Cache Viewer from command line
3. Click "Preference" menu item from Edit Menu
4. Select Advance tab and select Shortcut Creation property and enable "Prompt User"
5. Apply and close the Java Control Panel and Java Application Catch Viewer
6. Launch notepad form sun site(javaws http://java.sun.com/products/javawebstart/apps/notepad.jnlp).
7. JavaWebstart will prompt a dialog for Create ShortCut(s)
8. Click Configure button.
9. The focus border will be in advance tab.
10 Press tab key in keyboard

the control will shift to tree "Settings" and press tab key again the control will shift to "Ok" button again press tab key the control will shift to cancel button but the focus border is still in "Advance" tab

The focus border should be moved when first tab key is pressed to "Settings".


###@###.### 2004-05-17

Comments
EVALUATION The focus traversal is working, but is not initially drawn correctly. on Windows: focus is initially drawn on "advanced" tab, but not erased when tab key is hit and focus moved to tree. (works after you go back and forth) on Solaris (CDE): focus is not initially drawn on "advanced" tab, and works when taber away from and back. on linux (GTK): focus rectangle is still shown on "General" tab after "advanced" tab has been programatically selected. These are all mostlikely problems in the underlying swing plafs. ###@###.### 2004-05-17 Can Be reproduced with the attached CharTest.java as a stand alone app. Test shows two tabs and progratically selects the second one. on Solaris (CDE) : The selected (second) tab dosn't show focus rect. ------------------------------------- This type of issue is quite common when an application isn't respecting the Swing threading rules. Swing is not threadsafe and should not be manipulated on any thread other than the event dispatch thread. With main methods, we typically say that it is okay to touch Swing ONLY until the GUI has been realized (by way of pack() or setVisible(true)). The attached sample application breaks these guidelines. The main method has two calls to addPanel(...). addPanel adds components to the tabbed pane, sets the selection, and then calls pack() and setVisible(). After the first call to addPanel then, the GUI has been realized. Therefore the second call to addPanel is breaking Swing threading rules and any number of inconsistencies can be expected to happen. I realize that this is only a test case, but I suspect the application first mentioned in the description is doing something similar. Can I ask ###@###.### to look into this please? It should be easy to fix these issues by wrapping calls into Swing code in SwingUtilities.invokeLater(). ###@###.### 2004-05-18 not the case - I have modified the test case to do everything on the event q thread, same results. I added another button to the testcase so you could see what happens on windows (same problem as described for Java Control Panel, focus rect is initially drawn, but when focus transfers away, it isn't removed.). ###@###.### 2004-05-18 Name: sh120115 Date: 05/18/2004 Thanks to ###@###.### for the further evaluation. It turns out that this is in fact a bug in JTabbedPane. The root cause is that the focusIndex variable is (by default) initialized to 0 when BasicTabbedPaneUI is created. Instead, it should be initialized with -1 so that focusGained knows to set it when the component gains focus. It turns out that this is being addressed by 4974162. Closing as a duplicate. ###@###.### 2004-05-18 ======================================================================
18-05-2004