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

doNotCancelPopup can not be used in custom made components.

XMLWordPrintable

      A DESCRIPTION OF THE REQUEST :
      The client property "doNotCancelPopup" in the JComboBox (BasicComboBoxUI acutally) is used to control the state of the popup for the combo box in the case where if the popup is showing, clicking the button again will hide the popup.

      New components such as the JXDatePicker (at swingx.dev.java.net) can not use the JComboBox due to complications with subclassing (lack of access to internals). Other components may not even want to subclass JComboBox to get this behavior.

      Being able to use the "doNotCancelPopup" property for other components would require that the value stored in the client property table not be a package private StringBuffer.

      JUSTIFICATION :
      New components that want this behavior can't due to the fact that BasicPopupMenuUI looks for this client property specifically in BasicComboBoxUI.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      When I click on the popup button for my custom component and the popup is already showing I want the popup to hide.
      ACTUAL -
      When I click on the popup butotn for my custom component and the popup is already showing it hides and then reshows.

      ---------- BEGIN SOURCE ----------
      Download the swingx.dev.java.net source and modify the JXDatePicker to remove the "JComboBox" hack to work around the issue.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Steal the client property from an instance of a JComboBox and place it in my component. Obviously I can work around the issue, but I have to create unneeded components to do it.

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: