本文整理了Java中javax.swing.JTable.changeSelection()
方法的一些代码示例,展示了JTable.changeSelection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.changeSelection()
方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:changeSelection
暂无
代码示例来源:origin: nodebox/nodebox
private void moveMenuItemUp() {
int index = menuItemsTable.getSelectedRow();
// Return if nothing was selected.
if (index == -1) return;
// Return if the first item is selected.
if (index == 0) return;
nodeAttributesDialog.movePortMenuItemUp(portName, index);
// TODO: Changing the selection doesn't have any effect on Mac.
menuItemsTable.changeSelection(index - 1, 1, false, false);
}
代码示例来源:origin: stackoverflow.com
table.addMouseListener( new MouseAdapter()
{
public void mouseReleased(MouseEvent e)
{
if (e.isPopupTrigger())
{
JTable source = (JTable)e.getSource();
int row = source.rowAtPoint( e.getPoint() );
int column = source.columnAtPoint( e.getPoint() );
if (! source.isRowSelected(row))
source.changeSelection(row, column, false, false);
popup.show(e.getComponent(), e.getX(), e.getY());
}
}
});
代码示例来源:origin: stackoverflow.com
table.addMouseListener( new MouseAdapter()
{
public void mouseReleased(MouseEvent e)
{
if (e.isPopupTrigger())
{
JTable source = (JTable)e.getSource();
int row = source.rowAtPoint( e.getPoint() );
int column = source.columnAtPoint( e.getPoint() );
if (! source.isRowSelected(row))
source.changeSelection(row, column, false, false);
popup.show(e.getComponent(), e.getX(), e.getY());
}
}
});
代码示例来源:origin: nodebox/nodebox
private void moveMenuItemDown() {
int index = menuItemsTable.getSelectedRow();
// Return if nothing was selected.
if (index == -1) return;
java.util.List<MenuItem> items = getPort().getMenuItems();
// Return if the last item is selected.
if (index >= items.size() - 1) return;
nodeAttributesDialog.movePortMenuItemDown(portName, index);
// TODO: Changing the selection doesn't have any effect on Mac.
menuItemsTable.changeSelection(index + 1, 1, false, false);
}
代码示例来源:origin: pentaho/mondrian
public void changeSelection(
int rowIndex, int columnIndex, boolean toggle, boolean extend)
{
if (columnIndex == 0) {
AWTEvent currentEvent = EventQueue.getCurrentEvent();
if (currentEvent instanceof KeyEvent) {
KeyEvent ke = (KeyEvent) currentEvent;
int kcode = ke.getKeyCode();
if (kcode == KeyEvent.VK_TAB) {
if ((ke.getModifiersEx()
& InputEvent.SHIFT_DOWN_MASK)
== InputEvent.SHIFT_DOWN_MASK)
{
rowIndex -= 1;
if (rowIndex < 0) {
rowIndex = propertyTable.getRowCount() - 1;
}
}
setTableCellFocus(rowIndex);
return;
}
}
}
super.changeSelection(rowIndex, columnIndex, toggle, extend);
}
代码示例来源:origin: stackoverflow.com
source.changeSelection(row, column, false, false);
代码示例来源:origin: pentaho/mondrian
table.changeSelection(row, column, false, false);
activeEditor.setBackground(new java.awt.Color(224, 249, 255));
activeEditor.requestFocusInWindow();
代码示例来源:origin: senbox-org/snap-desktop
private boolean selectCurrentRaster(String rasterName, JTable table) {
final TableModel model = table.getModel();
for (int i = 0; i < model.getRowCount(); i++) {
final String s = model.getValueAt(i, NAME_COLUMN).toString();
if (rasterName.equals(s)) {
table.changeSelection(i, NAME_COLUMN, false, false);
return true;
}
}
return false;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-webui-designtime
/**
* Setter for property <code>options</code>. If component uses items of
* type {@link com.sun.rave.web.ui.model.Option}, use this method to set them.
*/
public void setOptions(Option[] options) {
this.setItems((SelectItem[]) options);
// Have the first row selected by default
if( options.length > 0 )
dataTable.changeSelection(0,0,false,false);
}
代码示例来源:origin: omegat-org/omegat
/**
* Set the selection.
* @param p the new point
*/
public void setSelection(Point p) {
getTable().changeSelection(p.y, p.x, false, false);
}
代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql
/**
* Shows the example for a specific configuration
*/
private void showExample(IWikiTableConfiguration selectedValue) {
// select all rows
exampleTable.changeSelection(0, 0, false, false);
exampleTable.changeSelection(exampleTable.getRowCount()-1, exampleTable.getColumnCount()-1, true, true);
String example = selectedValue.createTransformer().transform(this.exampleTable);
this.exampleText.setText(example);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-webui-designtime
private void downActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downActionPerformed
ItemsTableModel tableModel = (ItemsTableModel)dataTable.getModel();
if (dataTable.getSelectedRowCount() > 0) {
int[] selectedRows = dataTable.getSelectedRows();
tableModel.moveRowDown(selectedRows[0]);
dataTable.setModel(tableModel);
dataTable.changeSelection(selectedRows[0] + 1, 0, false, false);
}
}//GEN-LAST:event_downActionPerformed
代码示例来源:origin: org.opentcs/opentcs-plantoverview-panel-loadgenerator
private void deleteFromDOTableButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteFromDOTableButtonActionPerformed
if (doTable.getSelectedRow() == -1) {
return;
}
int selectedRow = doTable.getSelectedRow();
DriveOrderTableModel doTableModel = (DriveOrderTableModel) doTable.getModel();
doTableModel.removeData(selectedRow);
int indexToBeSelected = Math.min(selectedRow, doTableModel.getRowCount() - 1);
doTable.changeSelection(indexToBeSelected, 0, true, false);
updateElementStates();
}//GEN-LAST:event_deleteFromDOTableButtonActionPerformed
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors
private void upActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upActionPerformed
TableModelSupport tableModel = (TableModelSupport)dataTable.getModel();
if (dataTable.getSelectedRowCount() > 0) {
int[] selectedRows = dataTable.getSelectedRows();
if (selectedRows[0] > 0 && tableModel.canMoveRow(selectedRows[0], selectedRows[0] - 1)) {
tableModel.moveRow(selectedRows[0], selectedRows[0] - 1);
dataTable.setModel(tableModel);
dataTable.changeSelection(selectedRows[0] - 1, 0, false, false);
}
}
}//GEN-LAST:event_upActionPerformed
代码示例来源:origin: stackoverflow.com
table.addMouseListener( new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
JTable source = (JTable)e.getSource();
int row = source.rowAtPoint( e.getPoint() );
int column = source.columnAtPoint( e.getPoint() );
if (! source.isRowSelected(row))
source.changeSelection(row, column, false, false);
}
});
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-common
public void changeSelection(final int _row, final int _column, final boolean _toggle, final boolean _extend) {
if(getCursor()==TableColumnResizer.resizeCursor || getCursor()==TableRowResizer.RESIZE_CURSOR) {
return;
}
super.changeSelection(_row, _column, _toggle, _extend);
}
代码示例来源:origin: freeplane/freeplane
@Override
public void changeSelection(int rowIndex, int columnIndex, final boolean toggle, final boolean extend) {
final int rowCount = getRowCount();
if (rowCount == 0) {
return;
}
if (rowIndex >= rowCount) {
rowIndex = 0;
columnIndex = 0;
}
changeSelectedRowHeight(rowIndex);
super.changeSelection(rowIndex, columnIndex, toggle, extend);
}
代码示例来源:origin: omegat-org/omegat
private void moveRows(int[] rows, int col, int trgRow) {
modified = true;
Rectangle initialRect = panel.table.getVisibleRect();
panel.table.clearSelection();
BeadTableModel model = (BeadTableModel) panel.table.getModel();
List<Integer> realRows = model.realCellsInRowSpan(col, rows);
int[] resultRows = model.move(realRows, col, trgRow);
panel.table.changeSelection(resultRows[0], col, false, false);
panel.table.changeSelection(resultRows[1], col, false, true);
ensureSelectionVisible(initialRect);
}
代码示例来源:origin: net.imagej/imagej-ui-swing
private void addNew() {
add(new UpdateSite(makeUniqueSiteName("New"), "", "", "", null, null, 0l));
table.changeSelection( table.getRowCount()-1, 2, false, false);
if (table.editCellAt(table.getRowCount()-1, 2))
{
Component editor = table.getEditorComponent();
editor.requestFocusInWindow();
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors
/** Creates new form ItemsEditorPanel */
public TabularPropertyPanel(TabularPropertyModel tableModel, PropertyEditorBase editor) {
super(editor);
tableModel.addTableModelListener(this);
this.tableModelSupport = new TableModelSupport(tableModel);
initComponents();
// Have the first row selected by default
if( tableModel.getRowCount() > 0 )
dataTable.changeSelection(0,0,false,false);
}
内容来源于网络,如有侵权,请联系作者删除!