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

JTable's prepareEditor should not call setNextFocusableComponent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.2.2
    • client-libs
    • beta
    • generic
    • generic



      Name: dbT83986 Date: 08/07/99


      In JDK 1.2.2, JTable's prepareEditor calls
      setNextFocusableComponent without considering
      the use of custom editors. With custom meditors
      the programmers already set up the
      navigation among them via setNextFocusableComponent
      so that tabbing out of one custom editor would automatically
      take the cursor to the custom editor in the next column.
      JTable should NOT arbitrarily change the nextFocusableComponent.
      of the custom editors.
      In fact, the same method in JDK 1.2.1 does not do this.
      Please have this problem fixed ASAP, and have whoever
      in charge of JTable and JTree to take into the consideration
      of the use of custom editors. Even though the work-around
      solution is straight-forward, tracing the bug is
      very time-consuming for the developers who encounter this bug.

      Thank you.

      Michael Nguyen,

      PS. Below are "preparedEditor" for both JDK 1.2.1 and JDK 1.2.2
         to show the difference.

        // JDK 1.2.1
        public Component prepareEditor(TableCellEditor editor, int row, int column) {
          Object value = getValueAt(row, column);
          boolean isSelected = isCellSelected(row, column);
          Component comp = editor.getTableCellEditorComponent(this, value, isSelected,
            row, column);
          if((comp != null) && (comp.getFont() == null)) {
            comp.setFont(getFont());
          }
          return comp;
        }
        
          // JDK 1.2.2 version
          public Component prepareEditor(TableCellEditor editor, int row, int column) {
              Object value = getValueAt(row, column);
              boolean isSelected = isCellSelected(row, column);
              Component comp = editor.getTableCellEditorComponent(this, value, isSelected,
                                                        row, column);
              if (comp instanceof JComponent) {
                  ((JComponent)comp).setNextFocusableComponent(this);
                  
              }
           return com;
          }
      (Review ID: 93646)
      ======================================================================

            pmilnesunw Philip Milne (Inactive)
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: