Java 当我在jtable中向下滚动时,我的数据消失了,有人能建议吗?

Java 当我在jtable中向下滚动时,我的数据消失了,有人能建议吗?,java,swing,jtable,Java,Swing,Jtable,我使用了一个jtable,并向其中添加了一个模型,还向其中添加了文本区域渲染器和编辑器 Table.setModel( JUTableBindingFactory.createAttributeListBinding( Binding, Table name, View name, null, null, attributes)); Table.getColumnModel() .getColumn(i) .setCellEditor(

我使用了一个jtable,并向其中添加了一个模型,还向其中添加了文本区域渲染器和编辑器

Table.setModel(
  JUTableBindingFactory.createAttributeListBinding(
     Binding, Table name, View name, null, null, attributes));

 Table.getColumnModel()
      .getColumn(i)
      .setCellEditor(
         new TextAreaEditor(
           true, true, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
           JScrollPane.HORIZONTAL_SCROLLBAR_NEVER));

 Table.getColumnModel()
      .getColumn(i)
      .setCellRenderer(
         new TextAreaCellRenderer(
           true, true, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, 
           JScrollPane.HORIZONTAL_SCROLLBAR_NEVER));

 _Table.setRowHeight(100);
我还把桌子排好了

文本区域渲染器类

 public class TextAreaCellRenderer extends JTextArea implements TableCellRenderer
{
private JScrollPane pane;
private boolean _isEditable = false;
private boolean _isEnabled = false;
private int _verticalBarProperyValue = JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED;
private int _horizontalBarProperyValue = JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;


public TextAreaCellRenderer()
{
super();
init();
}

 public TextAreaCellRenderer(boolean isEnabled, boolean isEditable, int
             verticalBarProperyValue, int horizontalBarProperyValue)
 {
   super();
_isEditable = isEditable;
_isEnabled = isEnabled;
_verticalBarProperyValue = verticalBarProperyValue;
_horizontalBarProperyValue = horizontalBarProperyValue;
init();
}

private void init()
{
pane = new JScrollPane(this, _verticalBarProperyValue, _horizontalBarProperyValue);
setLineWrap(true);
setWrapStyleWord(true);
setEditable(_isEditable);
setEnabled(_isEnabled);
}


 /**
  * Returns the cell renderer component.
  */
  public Component getTableCellRendererComponent(JTable table, Object value, 
               boolean    isSelected, boolean hasFocus, int row, int column)
  {
setLineWrap(true);
setWrapStyleWord(true);
setText(value != null ? value.toString() : "");
setBackground((isSelected) ? NWSTheme.BLUE_DARK : NWSTheme.WHITE);
setForeground((isSelected) ? NWSTheme.WHITE : NWSTheme.BLACK);
pane.setEnabled(true);
return pane;           
}
 }

编辑器类也很相似,但问题似乎与此无关,我还应该尝试什么?

尝试将水平滚动条向上移动,因为有时我们不会这样做,并且会得到您体验的印象。至少尝试一下

否,当我向下滚动时,数据将消失,不再显示