我有一个JTable,其中表允许我最初一次只选择并拖动一行,然后它允许我从第二次选择并拖动多行,如何让它允许我选择第一次也是多行。
private void initialize()
{
propertyTable = GUI.getTable();
Vector columnVector = new Vector();
columnVector.addElement("Property Name");
columnVector.addElement("Alias Name");
propertyTableModel = new PropertyTableModel(getEmptyDataVector(),columnVector);
propertyTable.setModel(propertyTableModel);
propertyTable.getSelectionModel().addListSelectionListener(this);
propertyTable.getTableHeader().setReorderingAllowed(false);
propertyTable.getTableHeader().setBackground(new Color(47,81,121));
propertyTable.getTableHeader().setForeground(Color.white);
propertyTable.setDragEnabled(true);
propertyTable.setTransferHandler(new TransferHandler());
propertyColumn = propertyTable.getColumnModel().getColumn(0);
aliasColumn = propertyTable.getColumnModel().getColumn(1);
propertyColumn.setCellRenderer(new PropertyAliasColumnTableCellRenderer());
aliasColumn.setCellRenderer(new PropertyAliasColumnTableCellRenderer());
tablePanel = createPropertyNamesTablePanel();
setLayout(new BorderLayout(5,5));
add(tablePanel ,"Center");
}
private Vector getEmptyDataVector()
{
Vector dataVector = new Vector();
Vector rowVector = new Vector();
rowVector.addElement("");
rowVector.addElement("");
dataVector.addElement(rowVector);
return dataVector;
}