javax.swing.JTable.setRowSelectionInterval()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(391)

本文整理了Java中javax.swing.JTable.setRowSelectionInterval()方法的一些代码示例,展示了JTable.setRowSelectionInterval()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.setRowSelectionInterval()方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:setRowSelectionInterval

JTable.setRowSelectionInterval介绍

暂无

代码示例

代码示例来源:origin: marytts/marytts

table.setRowSelectionInterval(0, 0); // Show first row of prompt table as selected

代码示例来源:origin: marytts/marytts

jTable_PromptSet.setRowSelectionInterval(row + 1, row + 1);

代码示例来源:origin: dcevm/dcevm

public MainWindow() {
  super("Dynamic Code Evolution VM Installer");
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  Installer installer = new Installer(ConfigurationInfo.current());
  installations = new InstallationsTableModel();
  for (Installation i : installer.listInstallations()) {
    installations.add(i);
  }
  add(getBanner(), BorderLayout.NORTH);
  add(getCenterPanel(), BorderLayout.CENTER);
  add(getBottomPanel(), BorderLayout.SOUTH);
  if (table.getRowCount() > 0) {
    table.setRowSelectionInterval(0, 0);
  }
  pack();
  setMinimumSize(getSize());
}

代码示例来源:origin: winterDroid/android-drawable-importer-intellij-plugin

private void updateTable() {
  if (table == null ||
    tableModel == null) {
    return;
  }
  int selectedRow = table.getSelectedRow();
  tableModel.fireTableDataChanged();
  if (table.getRowCount() > 0) {
    selectedRow = MathUtils.clamp(selectedRow, 0, table.getRowCount());
    table.setRowSelectionInterval(selectedRow, selectedRow);
  } else {
    imageContainer.setDisabledIcon(null);
  }
}

代码示例来源:origin: magefree/mage

public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) {
  int selectedRow = -1;
  if (currentView.equals(mainModel)) {
    selectedRow = mainTable.getSelectedRow();
  }
  this.cards = showCards;
  this.bigCard = bigCard;
  this.gameId = gameId;
  cbSortBy.setSelectedItem(sortSetting.getSortBy());
  chkPiles.setSelected(sortSetting.isPilesToggle());
  currentView.loadCards(showCards, sortSetting, bigCard, gameId);
  if (selectedRow >= 0) {
    selectedRow = Math.min(selectedRow, mainTable.getRowCount() - 1);
    if (selectedRow >= 0) {
      mainTable.setRowSelectionInterval(selectedRow, selectedRow);
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
  public void mousePressed(MouseEvent e) {
    PanelConsoles.this.networkTable.requestFocusInWindow();
    // move selected row and place cursor on focused cell
    if (SwingUtilities.isRightMouseButton(e)) {
      Point p = e.getPoint();
      // get the row index that contains that coordinate
      int rowNumber = PanelConsoles.this.networkTable.rowAtPoint(p);
      int colNumber = PanelConsoles.this.networkTable.columnAtPoint(p);
      // Get the ListSelectionModel of the JTable
      DefaultListSelectionModel  model = (DefaultListSelectionModel) PanelConsoles.this.networkTable.getSelectionModel();
      DefaultListSelectionModel  model2 = (DefaultListSelectionModel) PanelConsoles.this.networkTable.getColumnModel().getSelectionModel();
      PanelConsoles.this.networkTable.setRowSelectionInterval(rowNumber, rowNumber);
      model.moveLeadSelectionIndex(rowNumber);
      model2.moveLeadSelectionIndex(colNumber);
    }
  }
});

代码示例来源:origin: freeplane/freeplane

public void actionPerformed(ActionEvent e) {
    int newSelectedRow = table.getSelectedRow() - 1;
    if(newSelectedRow >= 0)
      table.setRowSelectionInterval(newSelectedRow, newSelectedRow);
    
  }
});

代码示例来源:origin: freeplane/freeplane

public void actionPerformed(ActionEvent e) {
    int newSelectedRow = table.getSelectedRow() + 1;
    if(newSelectedRow < table.getRowCount())
      table.setRowSelectionInterval(newSelectedRow, newSelectedRow);
  }
});

代码示例来源:origin: stackoverflow.com

private void selectRows(JTable table, int start, int end) {
   // Use this mode to demonstrate the following examples
   table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
   // Needs to be set or rows cannot be selected
   table.setRowSelectionAllowed(true);
   // Select rows from start to end if start is 0 we change to 1 or leave it (used to preserve coloums headers)
   table.setRowSelectionInterval(start, end - 1);
 }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-sun-appsrv

public void mouseClicked(MouseEvent me) {
    if (me.getClickCount() == 2) {
    int row = tab.rowAtPoint(me.getPoint());
    if (row != -1) {
      tab.setRowSelectionInterval(row,row);
      editButtonActionPerformed(null);          
    }
    }
  }
});

代码示例来源:origin: kaikramer/keystore-explorer

private void setSelectedEntryByAlias(String alias) {
  JTable jtKeyStore = getActiveKeyStoreTable();
  for (int i = 0; i < jtKeyStore.getRowCount(); i++) {
    if (alias.equals(jtKeyStore.getValueAt(i, 3))) {
      jtKeyStore.setRowSelectionInterval(i, i);
      break;
    }
  }
}

代码示例来源:origin: chatty/chatty

private void selectClicked(MouseEvent e) {
  int clickedRow = entrantsTable.rowAtPoint(e.getPoint());
  if (clickedRow != -1 && !entrantsTable.isRowSelected(clickedRow)) {
    entrantsTable.setRowSelectionInterval(clickedRow, clickedRow);
  }
}

代码示例来源:origin: com.github.danielpacak.osgi.swingconsole/osgi.swingconsole

public void setSelectedBundle(BundleDTO bundle) {
  int modelRowIndex = tableModel.getRowIndex(bundle);
  if (modelRowIndex >= 0) {
    int viewRowIndex = table.convertRowIndexToView(modelRowIndex);
    table.setRowSelectionInterval(viewRowIndex, viewRowIndex);
  }
}

代码示例来源:origin: nz.ac.waikato.cms.moa/moa

public void runTask(Task task) {
  TaskThread thread = new TaskThread(task);
  this.taskList.add(0, thread);
  this.taskTableModel.fireTableDataChanged();
  this.taskTable.setRowSelectionInterval(0, 0);
  thread.start();
}

代码示例来源:origin: nz.ac.waikato.cms.moa/moa

public void runTask(Task task) {
  TaskThread thread = new TaskThread(task);
  this.taskList.add(0, thread);
  this.taskTableModel.fireTableDataChanged();
  this.taskTable.setRowSelectionInterval(0, 0);
  thread.start();
}

代码示例来源:origin: nz.ac.waikato.cms.moa/moa

public void runTask(Task task) {
  TaskThread thread = new TaskThread(task);
  this.taskList.add(0, thread);
  this.taskTableModel.fireTableDataChanged();
  this.taskTable.setRowSelectionInterval(0, 0);
  thread.start();
}

代码示例来源:origin: net.imagej/imagej-ui-swing

private void add(final UpdateSite site) {
  final int row = sites.size();
  files.addUpdateSite(site);
  sites.add(site);
  tableModel.rowsChanged();
  tableModel.rowChanged(row);
  table.setRowSelectionInterval(row, row);
  StaticSwingUtils.scrollToBottom(scrollpane);
}

代码示例来源:origin: net.java.dev.jets3t/jets3t

public void run() {
    if (s3ServiceMulti.createBuckets(new S3Bucket[] { newBucket })) {
      int modelIndex = bucketTableModel.getBucketIndexByName(newBucket.getName());
      int viewIndex = bucketTableModelSorter.viewIndex(modelIndex);
      bucketsTable.setRowSelectionInterval(viewIndex, viewIndex);
    }
  }
});

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

@Override
 public void tableChanged(TableModelEvent evt) {
  if (evt.getType() == TableModelEvent.UPDATE) {
   int column = evt.getColumn();
   int row = evt.getFirstRow();
   m_table.setColumnSelectionInterval(column + 1, column + 1);
   m_table.setRowSelectionInterval(row, row);
  }
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

public void run() {
    if (s3ServiceMulti.createBuckets(new S3Bucket[] { newBucket })) {
      int modelIndex = bucketTableModel.getBucketIndexByName(newBucket.getName());
      int viewIndex = bucketTableModelSorter.viewIndex(modelIndex);
      bucketsTable.setRowSelectionInterval(viewIndex, viewIndex);
    }
  }
});

相关文章

JTable类方法