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

unix: javax.swing.JInternalFrame.setSelected doesn't fire PropertyChangeEvent

XMLWordPrintable



      Name: skR10017 Date: 05/31/2000



      Class javax.swing.JInternalFrame contains a bug.

      When isShowing() function returns false and selected==true PropertyChangeEvent is not fired
      because return statement is executed.

      Here is citation from the source file:

      ------------------ src/javax/swing/JInternalFrame.java --------------------
           public void setSelected(boolean selected) throws PropertyVetoException {
              if ((isSelected == selected) || (selected && !isShowing())) {
                  return;
              }

              Boolean oldValue = isSelected ? Boolean.TRUE : Boolean.FALSE;
              Boolean newValue = selected ? Boolean.TRUE : Boolean.FALSE;
              fireVetoableChange(IS_SELECTED_PROPERTY, oldValue, newValue);
      if(selected) {
      JRootPane r = getRootPane();
      if (r.getCurrentFocusOwner() != null) {/* do nothing */
      } else if (r.getPreviousFocusOwner() != null) {
      r.getPreviousFocusOwner().requestFocus();
      } else {
      getContentPane().requestFocus();
      }
      }
              isSelected = selected;
              firePropertyChange(IS_SELECTED_PROPERTY, oldValue, newValue);
      if (isSelected)
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ACTIVATED);
      else
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED);
              repaint();
          }

      --------------------------------------------------------------------------------


      BeanFire test from Swing testsuite fails due to this reason.

      This bug affects JDK1.3 for Linux(beta07) and Solaris(build 1.3.0rc3-Z)

      Suggestion fix:
      to remove (selected && !isShowing()) from if operator condition
      or throw PropertyVetoException if this value of selected property can't be set.

      ======================================================================

            hgajewsksunw Hania Gajewska (Inactive)
            kotlsunw Kotl Kotl (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: