JDK-4758890 : REGRESSION: Focus not painted in JToolBar with Windows PLAF
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2002-10-07
  • Updated: 2005-09-07
  • Resolved: 2005-09-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
6Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Name: rmT116609			Date: 10/07/2002


FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
When using j2sdk 1.4 or 1.4.1 the buttons in a JToolbar do not draw the focus border in the Windows look and feel. If I use any other look and feel the focus border is drawn fine. Works fine in jdk 1.3.1 and 1.2.2 with the Windows
PLAF.

REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a application with a JToolbar
2. Add a button or action to the toolbar
3. Set the look and feel to windows
4. Run the application and use the tab key to move between
components.
5. Pressing the space bar will press the toolbar buttons
but you cannot tell which one you are on.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;


public class ActionExample extends JFrame {

	private JToolBar toolBar;
	NewAction newAction;
	OpenAction openAction;

	public ActionExample() {
		super("Action Example");
		Container contentPane = this.getContentPane();


		// Create a ToolBar
		toolBar = new JToolBar();
		//toolBar.setRollover(true);
		contentPane.add(BorderLayout.NORTH, toolBar);

		// Create an action for New, Open, and mango (disable)
		newAction = new NewAction("New", new ImageIcon("new.gif"));
		openAction = new OpenAction("Open", new ImageIcon("open.gif"));


		// Add the new, open actions to the toolbar
		JButton newBut = toolBar.add(newAction);
		newBut.setToolTipText("What's New");
		JButton openBut = toolBar.add(openAction);
		openBut.setFocusPainted(true);
		openBut.setToolTipText("Open sesame");

		JPanel p = new JPanel();
		p.add(new JButton("button 1"));
		p.add(new JButton("button 2"));
		contentPane.add(BorderLayout.SOUTH, p);

		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
	}

	/**
	 * An inner class that extends AbstractAction.
	 * This class does little more than provide an actionPerformed() method
	 */
	class NewAction extends AbstractAction {

		public NewAction(String name, Icon icon) {
			super(name, icon);
		}

		public void actionPerformed(ActionEvent ae) {
			System.out.println("New");
		}
	}

	/**
	 * An inner class that extends AbstractAction.
	 * This class does little more than provide an actionPerformed() method
	 */
	class OpenAction extends AbstractAction {

		public OpenAction(String name, Icon icon) {
			super(name, icon);
		}

		public void actionPerformed(ActionEvent ae) {
			System.out.println("Open");
		}
	}

	public static void main(String argv[]) {
		try {
			UIManager.setLookAndFeel
("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		} catch (Exception ex) {
			System.out.println(ex);
		}
		ActionExample ae = new ActionExample();
		ae.setSize(400,200);
		ae.setVisible(true);
	}
}
---------- END SOURCE ----------

Release Regression From : 1.3.1_05
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Review ID: 165190) 
======================================================================

Comments
EVALUATION Will fix in an upcoming release. ###@###.### 2002-10-18
18-10-2002