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

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

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

JTable.getSelectedColumn介绍

暂无

代码示例

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

table.addMouseListener(new MouseAdapter() {
 public void mouseClicked(MouseEvent e) {
  if (e.getClickCount() == 2) {
   JTable target = (JTable)e.getSource();
   int row = target.getSelectedRow();
   int column = target.getSelectedColumn();
   // do some action if appropriate column
  }
 }
});

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

int col = dialogTable.getSelectedColumn();
String str = "Selected Row(s): ";
int[] rows = dialogTable.getSelectedRows();
  str += cols[i] + " ";
str += "Selected Cell: " + dialogTable.getSelectedRow() + ", " + dialogTable.getSelectedColumn();
System.out.println(str);
Object value = dialogTable.getValueAt(row, col);

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

public void mouseClicked (MouseEvent e) {
    int row = table.getSelectedRow();
    int column = table.getSelectedColumn();
    if (column == 5) {
      URI uri = ((ExtensionTableModel)table.getModel()).getURI(row, column);
      if (uri != null) {
        try {
          Desktop.getDesktop().browse(uri);
        } catch (IOException e1) {
          e1.printStackTrace();
        }
      }
    }
  }
});

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

JTable table = ...;
TableModel model = ...;

int viewRow = table.getSelectedRow();
int modelRow = table.convertRowIndexToModel(viewRow);
int viewColumn = table.getSelectedColumn();
int modelColumn = table.convertColumnIndexToModel(viewColumn);
Object cell = model.getValueAt( modelRow, modelColumn );

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

JPopupMenu popup = (JPopupMenu)c.getParent();
JTable table = (JTable)popup.getInvoker();
System.out.println(table.getSelectedRow() + " : " + table.getSelectedColumn());

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

public void mouseClicked(java.awt.event.MouseEvent e) {
  JTable target = (JTable)e.getSource();
  int row = target.getSelectedRow();
  int column = target.getSelectedColumn();
  if((row >=0) && (column >=0)){
   //Stuff
  }

 }
});

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

calenderTable.addMouseListener(new MouseAdapter() {
 public void mouseClicked(MouseEvent e) {
  if (e.getClickCount() == 2) {
   JTable target = (JTable)e.getSource();
   int row = target.getSelectedRow();
   int column = target.getSelectedColumn();
   // do some stuff
  }
 }
});

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

table.addMouseListener(new MouseAdapter() {
  public void mouseClicked(MouseEvent e) {
     JTable target = (JTable) e.getSource();

     int rowIndex = target.getSelectedRow();
     int columnIndex = target.getSelectedColumn();

    System.out.println(target.getModel().getValueAt(rowIndex, columnIndex));
   }
});

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

@Override
  public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() == 2) {
      editCell(table.getSelectedRow(), table.getSelectedColumn());
    }
  }
});

代码示例来源:origin: igniterealtime/Spark

@Override
public void mousePressed(MouseEvent e) {
  if (e.getClickCount() == 2) {
    JTable source = (JTable) e.getSource();
    if (e.getSource() == certTable && source.getSelectedColumn() != 2) {
      certControll.showCertificate();
    }
  }
  if(e.getSource() == certTable){
    showCert.setEnabled(true);
  }
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

@Override
  public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() == 2) { // double click
      TableModel tm = table.getModel();
      Object value = tm.getValueAt(table.getSelectedRow(), table.getSelectedColumn());
      new TextBoxDialoger(value.toString(), false); // view only NOSONAR this instantiation opens a popup
    }
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
   * Checks if the selected cell is editable. If yes, we will not activate Searchable when key is typed.
   *
   * @return true if the selected cell is editable.
   */
  protected boolean isSelectedCellEditable() {
    int selectedRow = ((JTable) _component).getSelectedRow();
    int selectedColumn = ((JTable) _component).getSelectedColumn();
    return selectedRow != -1 && selectedColumn != -1 && ((JTable) _component).isCellEditable(selectedRow, selectedColumn);
  }
}

代码示例来源:origin: omegat-org/omegat

@Override
  public void keyReleased(KeyEvent evt) {
    if (evt.getKeyCode() == KeyEvent.VK_INSERT) {
      int col = panel.allCharTable.getSelectedColumn();
      int row = panel.allCharTable.getSelectedRow();
      selCharModel.appendChar((Character) allCharModel.getValueAt(row, col),
          panel.uniqueCheckBox.isSelected());
    }
  }
});

代码示例来源:origin: omegat-org/omegat

/**
 * Get the point selected in the table.
 * @return
 */
public Point getSelectionPoint() {
  return new Point(getTable().getSelectedColumn(), getTable().getSelectedRow());
}

代码示例来源:origin: omegat-org/omegat

@Override
  public void mouseClicked(MouseEvent evt) {
    if (panel.allCharTable.isEnabled() && evt.getClickCount() == 2) {
      JTable target = (JTable) evt.getSource();
      int row = target.getSelectedRow();
      int col = target.getSelectedColumn();
      selCharModel.appendChar((Character) allCharModel.getValueAt(row, col),
          panel.uniqueCheckBox.isSelected());
    }
  }
});

代码示例来源:origin: org.geotools/gt2-widgets-swing

/** Invoked when a new cell is selected. */
public void valueChanged(final ListSelectionEvent event) {
  if (!event.getValueIsAdjusting()) {
    final ImageTableModel samples = (ImageTableModel) table.getModel();
    final Color c=samples.getColorAt(table.getSelectedRow(), table.getSelectedColumn());
    if (!Utilities.equals(c, color)) {
      color = c;
      repaint();
    }
  }
}

代码示例来源:origin: biblelamp/JavaExercises

@Override
  public void mousePressed(MouseEvent e) {
    super.mousePressed(e);
    if (e.getClickCount() == 2) {
      int row = table.getSelectedRow();
      int col = table.getSelectedColumn();
      if (col == 0)
        readAndAnalize((String)table.getValueAt(row, col));
    }
  }
});

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

@Override
  public void actionPerformed(ActionEvent e) {
    invokeOriginalAction(e);
    
    int row = table.getSelectedRow();
    int column = table.getSelectedColumn();
    
    if (table.isCellEditable(row, column)) {
      table.editCellAt(row, column, e);
    }
  }
}

代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-misc-swing

@Override
  public void actionPerformed(ActionEvent ae) {
    TableModel model = getModel();
    int maxcolumns = model.getColumnCount();
    int column = table.getSelectedColumn() + 1;
    if (column < maxcolumns) {
      table.setColumnSelectionInterval(column, column);
    } else {
      table.setColumnSelectionInterval(0, 0);
    }
  }
};

代码示例来源:origin: org.jclarion/clarion-runtime

private void notifyNewSelection()
{
  GUIModel.getServer().send(this,LIST_ACCEPT,
    qtm.getQueue().convertScreenIndexToQueueIndex(table.getSelectedRow()) + 1,
    qtm.getQueue().convertScreenIndexToQueueIndex(table.getSelectionModel().getMaxSelectionIndex()) + 1,
    table.getSelectedColumn() + 1  );
}

相关文章

JTable类方法