Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-3260

[classlib][swing] Can't draw JTable's cell with custom cell renderer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Classlib
    • None
    • all

    Description

      The problem takes place in jEdit (4.2 final) application running on DRLVM.
      Just try to set docking options for some plugins and empty table cells
      will be visible (they must display combo boxes). The following simplified
      test reproduces the problem:
      --------------

      import javax.swing.JFrame;
      import javax.swing.JTable;
      import javax.swing.JComboBox;
      import javax.swing.table.TableCellRenderer;
      import javax.swing.table.AbstractTableModel;
      import java.awt.Component;

      public class c {
      public static void main(String[] args) {
      JFrame frame = new JFrame("test");
      final JComboBox box = new JComboBox(new String[]

      {"test"}

      );
      JTable t = new JTable(
      new AbstractTableModel() {
      public int getRowCount()

      {return 2;}
      public int getColumnCount() {return 2;}

      public Class getColumnClass(int col)

      { return col==0?Integer.class:String.class; }

      public Object getValueAt(int row, int col)

      { return col==0?new Integer(99):"test"; }

      });
      t.setDefaultRenderer(
      t.getColumnClass(1),
      new TableCellRenderer() {
      public Component getTableCellRendererComponent(JTable table,
      Object value, boolean isSelected, boolean hasFocus,
      int row, int column)

      { return box; }

      });
      frame.add(t);
      frame.pack();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
      }
      }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vmolotkov Vladimir Molotkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: