List of usage examples for javax.swing JTable setColumnSelectionInterval
public void setColumnSelectionInterval(int index0, int index1)
index0
to index1
, inclusive. From source file:Main.java
public static void main(String[] argv) throws Exception { int rows = 10; int cols = 5; JTable table = new JTable(rows, cols); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); table.setColumnSelectionAllowed(true); table.setRowSelectionAllowed(false); // Select a column - column 0 table.setColumnSelectionInterval(0, 0); }
From source file:MainClass.java
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { if (value == null) { return this; }/*from w ww. j a v a 2s . c o m*/ if (value instanceof Volume) { setValue(((Volume) value).getVolume()); } else { setValue(0); } table.setRowSelectionInterval(row, row); table.setColumnSelectionInterval(column, column); originalValue = getValue(); editing = true; Point p = table.getLocationOnScreen(); Rectangle r = table.getCellRect(row, column, true); helper.setLocation(r.x + p.x + getWidth() - 50, r.y + p.y + getHeight()); helper.setVisible(true); return this; }
From source file:org.tmpotter.ui.ActionHandler.java
public void onTableClicked(MouseEvent evt) { javax.swing.JTable table = (javax.swing.JTable) evt.getSource(); Point point = evt.getPoint(); int row = table.rowAtPoint(point); int col = table.columnAtPoint(point); table.setRowSelectionInterval(row, row); table.setColumnSelectionInterval(col, col); tmData.setPositionTextArea(0);//from w ww . ja v a 2s. c om if (tmData.getIndexPrevious() < tmData.getDocumentOriginalSize()) { tmData.setOriginalDocumentAnt(restoreText(modelMediator.getLeftEdit())); tmData.setTranslationDocumentAnt(restoreText(modelMediator.getRightEdit())); } modelMediator.setLeftEdit(formatText(modelMediator.getLeftSegment(modelMediator.getTmViewSelectedRow()))); modelMediator.setRightEdit(formatText(modelMediator.getRightSegment(modelMediator.getTmViewSelectedRow()))); tmData.setBothIndex(modelMediator.getTmViewSelectedRow()); if (tmData.isIdentTop()) { modelMediator.setJoinEnabled(false); } else { modelMediator.setJoinEnabled(true); } modelMediator.updateTmView(); }