You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vladimir Molotkov (JIRA)" <ji...@apache.org> on 2007/02/28 06:41:05 UTC

[jira] Created: (HARMONY-3260) [classlib][swing] Can't draw JTable's cell with custom cell renderer

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

                 Key: HARMONY-3260
                 URL: https://issues.apache.org/jira/browse/HARMONY-3260
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: all
            Reporter: Vladimir Molotkov


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);
    }
}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.