本文整理汇总了Java中javax.swing.table.DefaultTableModel.removeRow方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultTableModel.removeRow方法的具体用法?Java DefaultTableModel.removeRow怎么用?Java DefaultTableModel.removeRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.table.DefaultTableModel
的用法示例。
在下文中一共展示了DefaultTableModel.removeRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setHandsAndBallsTableSize
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
final private void setHandsAndBallsTableSize() {
final int intLballsPreviousNumber = this.intGballsNumber;
this.intGballsNumber =
Math.max( 0,
this.objGjuggleMasterPro.objGsiteswap == null
|| this.objGjuggleMasterPro.objGsiteswap.bytGstatus <= Constants.bytS_STATE_SITESWAP_UNKNOWN_BALLS_NUMBER
? 0
: this.objGjuggleMasterPro.objGsiteswap.intGballsNumber);
if (this.intGballsNumber != intLballsPreviousNumber) {
final DefaultTableModel objLdefaultTableModel = (DefaultTableModel) this.objGhandsAndBallsJTable.getModel();
if (this.intGballsNumber > intLballsPreviousNumber) {
for (int intLballIndex = intLballsPreviousNumber; intLballIndex < this.intGballsNumber; ++intLballIndex) {
objLdefaultTableModel.addRow(new String[DataJFrame.bytS_HANDS_AND_BALLS_TABLE_COLUMNS_NUMBER]);
}
} else {
for (int intLballIndex = intLballsPreviousNumber; intLballIndex > this.intGballsNumber; --intLballIndex) {
objLdefaultTableModel.removeRow(intLballIndex + 1);
}
}
}
}
示例2: Show_Users_In_JTable
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void Show_Users_In_JTable() {
DefaultTableModel modele = (DefaultTableModel)jTable1.getModel();
Object[] row = new Object[3]; for (int i = 0; i < jTable1.getRowCount(); i++) { modele.removeRow(i); }
String active = "" ;
for(int i = 0; i < Plugins.size(); i++)
{
try {
String text = new String(Files.readAllBytes(Paths.get(pluginMapPath.get(i))), StandardCharsets.UTF_8);
if (text.contains(" deactivated")) { active = "NO"; } else { active = "YES"; }
row[0] = Plugins.get(i).getName();
row[1] = Plugins.get(i).category();
row[2] = active ;
modele.addRow(row);
} catch (IOException ex) {
Logger.getLogger(PluginManager.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
示例3: changeRow
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void changeRow(Object fo, String key) {
Integer row = key2RowNumber.get(key);
DefaultTableModel model = (DefaultTableModel) times.getModel();
if (row != null) {
model.removeRow(row);
}
TimesCollectorPeer.Description desc = TimesCollectorPeer.getDefault().getDescription(fo, key);
if (desc == null) {
return ;
}
if (row == null) {
key2RowNumber.put(key, row = model.getRowCount());
}
model.insertRow(row, new Object[] {desc.getMessage(), desc.getTime()});
}
示例4: deleteMouseClicked
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void deleteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_deleteMouseClicked
// TODO add your handling code here:删除快照
int op = JOptionPane.showConfirmDialog(rootPane, "确定要删除吗", "提示", JOptionPane.YES_NO_OPTION);
//点是返回0,否返回1,有悖常理啊
String snapshotID = null;
snapshotID = snapshotList.getValueAt(snapshotList.getSelectedRow(), 0).toString();
if (op == 0) {
rebuild.doSnapshot(cAuth, cRegion, snapshotID, "DeleteSnapshot", null);
JOptionPane.showMessageDialog(null, "删除快照指令已发出", "提示", JOptionPane.INFORMATION_MESSAGE);
DefaultTableModel tableModel = (DefaultTableModel) snapshotList.getModel();
tableModel.removeRow(snapshotList.getSelectedRow());
}
else
System.out.println("操作已取消");
}
示例5: supprimerActionPerformed
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void supprimerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_supprimerActionPerformed
if (!list.isEmpty()) {
DefaultTableModel model1 = (DefaultTableModel) jTable1.getModel();
model1.removeRow(count - 1);
list.remove(list.size() - 1);
System.out.println(list.size() - 1);
System.out.println(count);
count--;
} else {
JOptionPane.showMessageDialog(this, "Tableau vide");
}
}
示例6: moveUpVarButtonActionPerformed
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void moveUpVarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveUpVarButtonActionPerformed
int index = childrenVariablesTable.getSelectedRow();
if (index <= 0) return ;
DefaultTableModel model = (DefaultTableModel) childrenVariablesTable.getModel();
Object[] row = new Object[] { model.getValueAt(index, 0), model.getValueAt(index, 1) };
model.removeRow(index);
model.insertRow(index - 1, row);
childrenVariablesTable.getSelectionModel().setSelectionInterval(index - 1, index - 1);
}
示例7: moveDownVarButtonActionPerformed
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void moveDownVarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveDownVarButtonActionPerformed
int index = childrenVariablesTable.getSelectedRow();
if (index < 0) return ;
DefaultTableModel model = (DefaultTableModel) childrenVariablesTable.getModel();
if (index >= (model.getRowCount() - 1)) return ;
Object[] row = new Object[] { model.getValueAt(index, 0), model.getValueAt(index, 1) };
model.removeRow(index);
model.insertRow(index + 1, row);
childrenVariablesTable.getSelectionModel().setSelectionInterval(index + 1, index + 1);
}
示例8: fillTimeTable
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void fillTimeTable() {
Reference ref = (Reference)jList1.getSelectedValue();
Object fo = ref == null ? null : ref.get();
// clear the table
DefaultTableModel model = (DefaultTableModel) times.getModel();
while (model.getRowCount() > 0) {
model.removeRow(0);
}
key2RowNumber.clear();
if (fo == null) return;
Collection<String> keys = TimesCollectorPeer.getDefault().getKeysForFile(fo);
for (int i = 0; i < 10; i++) {
try {
synchronized(keys) {
for (String key : keys) {
changeRow(fo, key);
}
return;
}
} catch (ConcurrentModificationException ex) {
LOG.log(Level.INFO, "Retry " + i, ex);
}
}
}
示例9: clearEmptyRow
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private synchronized void clearEmptyRow() {
DefaultTableModel dftm = (DefaultTableModel) table.getModel();
for (int i = 0; i < table.getRowCount(); i++) {
TbSpinfo info2 = (TbSpinfo) table.getValueAt(i, 0);
if (info2 == null || info2.getId() == null
|| info2.getId().isEmpty()) {
dftm.removeRow(i);
}
}
}
示例10: removeOptionButtonActionPerformed
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void removeOptionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeOptionButtonActionPerformed
DefaultTableModel model = (DefaultTableModel) processorOptionsTable.getModel();
int[] rows = processorOptionsTable.getSelectedRows();
for(int i = rows.length - 1 ; i >= 0 ; i--) {
model.removeRow(rows[i]);
}
if (model.getRowCount() > 0) {
// Select reasonable row
int selectedIndex = rows[rows.length - 1] - rows.length + 1;
if ( selectedIndex > model.getRowCount() - 1) {
selectedIndex = model.getRowCount() - 1;
}
processorOptionsTable.setRowSelectionInterval(selectedIndex, selectedIndex);
}
}
示例11: removeCapActionPerformed
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void removeCapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeCapActionPerformed
int[] rows = capTable.getSelectedRows();
if (rows != null) {
DefaultTableModel model = (DefaultTableModel) capTable.getModel();
for (int i = rows.length - 1; i >= 0; i--) {
model.removeRow(rows[i]);
}
}
}
示例12: removeActionPerformed
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void removeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeActionPerformed
int[] rows = moduleTable.getSelectedRows();
if (rows != null) {
DefaultTableModel model = (DefaultTableModel) moduleTable.getModel();
for (int i = rows.length - 1; i >= 0; i--) {
model.removeRow(rows[i]);
}
}
}
示例13: limpiarTabla
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public void limpiarTabla(DefaultTableModel modelo) //recibe el modelo de la tabla
{
int filas = modelo.getRowCount(); //para saber cuantas filas tiene la tabla hasta el momento
for(int i=0;i<filas;i++)//colocamos "<" porque sino borrara una fila inexistente
{
modelo.removeRow(0); //para que valla borrando borrando la PRIMERA linea(que en si es toda la tabla)
}
}
示例14: updateTable
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void updateTable(List list, final DefaultTableModel dftm) {
int num = dftm.getRowCount();
for (int i = 0; i < num; i++)
dftm.removeRow(0);
Iterator iterator = list.iterator();
TbKhinfo khInfo;
while (iterator.hasNext()) {
List info = (List) iterator.next();
Item item = new Item();
item.setId((String) info.get(0));
item.setName((String) info.get(1));
khInfo = Dao.getKhInfo(item);
Vector rowData = new Vector();
rowData.add(khInfo.getId().trim());
rowData.add(khInfo.getKhname().trim());
rowData.add(khInfo.getAddress().trim());
rowData.add(khInfo.getJian().trim());
rowData.add(khInfo.getBianma().trim());
rowData.add(khInfo.getTel().trim());
rowData.add(khInfo.getFax().trim());
rowData.add(khInfo.getLian().trim());
rowData.add(khInfo.getLtel().trim());
rowData.add(khInfo.getMail().trim());
rowData.add(khInfo.getXinhang().trim());
rowData.add(khInfo.getHao().trim());
dftm.addRow(rowData);
}
}
示例15: updateTable
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void updateTable(List list, final DefaultTableModel dftm) {
int num = dftm.getRowCount();
for (int i = 0; i < num; i++)
dftm.removeRow(0);
Iterator iterator = list.iterator();
TbSpinfo spInfo;
while (iterator.hasNext()) {
List info = (List) iterator.next();
Item item = new Item();
item.setId((String) info.get(0));
item.setName((String) info.get(1));
spInfo = Dao.getSpInfo(item);
Vector rowData = new Vector();
rowData.add(spInfo.getId().trim());
rowData.add(spInfo.getSpname().trim());
rowData.add(spInfo.getJc());
rowData.add(spInfo.getCd());
rowData.add(spInfo.getDw());
rowData.add(spInfo.getGg());
rowData.add(spInfo.getBz());
rowData.add(spInfo.getPh());
rowData.add(spInfo.getPzwh());
rowData.add(spInfo.getGysname());
rowData.add(spInfo.getMemo());
dftm.addRow(rowData);
}
}