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

JButton inside a Popup not getting focus on mouse click

XMLWordPrintable

    • sparc
    • generic

      The JButton inside a popup is not getting the focus after first mouse click. This happens in Solaris Sparc machines and is not happening in Windows platforms.

      Step to reproduce: Click the button that pops out on running the following program.

      Hardware & OS in which testing done: Ultra 10 & OS ver 5.7

      Code to reproduce:
      import java.awt.*;
      import javax.swing.*;

      public class poptest01 {
        JLabel label;
        JButton button;
        
        public poptest01() {
          button = new JButton("Hello, World!");
          button.setBackground(Color.green);
          button.setToolTipText("it is a button!");
          
          PopupFactory factory = PopupFactory.getSharedInstance();
          Popup popup = factory.getPopup(null, button, 100, 200);
          popup.show();
          /*try {
            Thread.sleep(2000);
          }
          catch (InterruptedException ie) {
            ie.printStackTrace();
          }*/
          //popup.hide();
        }
        
        public static void main(String args[]) {
          poptest01 s = new poptest01();
        }
      }

      More info:
      The button is not getting the dotted rectangle around the button name, which indicates that the button indeed has the focus.

      sridhar.raman@eng 2001-08-06

            dmikhalksunw Denis Mikhalkin (Inactive)
            sramansunw Sridhar Raman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: