Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4758890

REGRESSION: Focus not painted in JToolBar with Windows PLAF

    XMLWordPrintable

    Details

      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)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jmarinacsunw Joshua Marinacci (Inactive)
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: