swingx
  1. swingx
  2. SWINGX-1396

JXTable fail to change boolean value

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.0, 1.6, 1.6.1, 1.6.2
    • Fix Version/s: None
    • Component/s: Table
    • Labels:
      None
    • Environment:

      Windows 7, Windows XP. JDK 1.6_15 and 1.6_20 but not 1.5. (Other versions of Djdk 1.6 no tested)

      Description

      With a JXTable who contains editable Boolean columns. The editor cannot change the cell value. I have quickly wrote another TableCellEditor for this JXTable and he works. The only changes with yours is that I listen action on the checkbox to update a boolean.
      Here is my editor (poorly writed) :

      // ---------------------------------------------------------
      private static class Editor extends DefaultCellEditor {

      JCheckBox chk = null;
      final boolean[] checked = new boolean[]

      {true}

      ;

      public Editor() {
      super(new JCheckBox());
      chk = (JCheckBox) getComponent();
      chk.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e)

      { checked[0] = !checked[0]; }

      });
      }

      @Override
      public Object getCellEditorValue()

      { return checked[0]; }

      @Override
      public Component getTableCellEditorComponent(JTable table,
      Object value, boolean isSelected, int row, int column)

      { JCheckBox chk =(JCheckBox) super.getTableCellEditorComponent(table, value, isSelected, row, column); checked[0] = ((Boolean) value).booleanValue(); chk.setSelected(checked[0]); return chk; }


      }
      // ------------------------------------------------------------

        Activity

        Hide
        kleopatra added a comment -

        can't reproduce - and the editor is the exact same as in a core JTable: a DefaultCellEditor vending a JCheckBox, the editor does all the wiring. There must be something else wrong in your code.

        To verify that the default editors work smoothly in JXTable smoothly, run any of the visual tests containing a table with booleans, f.i. in JXTableVisualCheck.

        Will close as worksforme - except you convince me with a small runnable example demonstrating the problem

        Cheers
        Jeanette

        Show
        kleopatra added a comment - can't reproduce - and the editor is the exact same as in a core JTable: a DefaultCellEditor vending a JCheckBox, the editor does all the wiring. There must be something else wrong in your code. To verify that the default editors work smoothly in JXTable smoothly, run any of the visual tests containing a table with booleans, f.i. in JXTableVisualCheck. Will close as worksforme - except you convince me with a small runnable example demonstrating the problem Cheers Jeanette
        Hide
        kleopatra added a comment -

        closing a worksforme , please feel free to re-open with a short runnable example

        Show
        kleopatra added a comment - closing a worksforme , please feel free to re-open with a short runnable example
        Hide
        gervaisb added a comment -

        The bug has been discovered into our app (closed source) I'm going to write a code who reproduce the bug on my free time. Please be patient

        Show
        gervaisb added a comment - The bug has been discovered into our app (closed source) I'm going to write a code who reproduce the bug on my free time. Please be patient

          People

          • Assignee:
            kleopatra
            Reporter:
            gervaisb
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1 hour
              1h
              Remaining:
              Remaining Estimate - 1 hour
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified