在我的应用程序中,我有一个2列org.jdesktop.swingx.JXTable。两列都包含字符串数据。一列使用默认单元格编辑器(org.jdesktop.swingx.JXTable.GenericEditor),另一列使用自定义单元格编辑器(CustomCellEditor.java)。JTable单元格渲染差异跨平台
与Windows L & F两个单元格都呈现相同;然而,与GTK L & F有一些细微差别,导致文本被遮盖。需要设置什么属性才能在GTK上正确呈现自定义编辑器?
private class CustomCellEditor extends DefaultCellEditor
{
public CustomCellEditor(int maxStringLength)
{
super(new JTextField()
((JTextField) editorComponent).setDocument(new CustomDocument(maxStringLength));
}
class CustomDocument extends PlainDocument
{
private int limit;
public CustomDocument(int limit)
{
super();
this.limit = limit;
}
@Override
public void insertString(int offset, String str, AttributeSet attr)
throws BadLocationException
{
//...
}
}
}
默认的Windows:
自定义在Windows上:在Ubuntu
默认:
自定义在Ubuntu:
试着把'setBorder(null)' – nachokk