本文整理匯總了Java中javax.swing.ListSelectionModel.getMaxSelectionIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java ListSelectionModel.getMaxSelectionIndex方法的具體用法?Java ListSelectionModel.getMaxSelectionIndex怎麽用?Java ListSelectionModel.getMaxSelectionIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.ListSelectionModel
的用法示例。
在下文中一共展示了ListSelectionModel.getMaxSelectionIndex方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Selection
import javax.swing.ListSelectionModel; //導入方法依賴的package包/類
public Selection(ListSelectionModel sm) {
selectionMode = sm.getSelectionMode();
anchor = sm.getAnchorSelectionIndex();
lead = sm.getLeadSelectionIndex();
int min = sm.getMinSelectionIndex();
int max = sm.getMaxSelectionIndex();
int i1 = -1;
for (int i = min; i <= max; i++) {
if (sm.isSelectedIndex(i)) {
if (i1 == -1) {
i1 = i;
}
} else {
if (i1 != -1) {
intervals.add(new int[] { i1, i});
i1 = -1;
}
}
}
if (i1 != -1) {
intervals.add(new int[] { i1, max});
}
}
示例2: copyAnchorToSelection
import javax.swing.ListSelectionModel; //導入方法依賴的package包/類
public void copyAnchorToSelection() {
if ((getSelectedRowCount() == 0) && (getSelectedColumnCount() == 0)) {
return;
}
if (dataModel instanceof ExactTableModel) {
stopEditing();
int rowFrom = selectionModel.getMinSelectionIndex();
int rowTo = selectionModel.getMaxSelectionIndex();
ListSelectionModel csm = columnModel.getSelectionModel();
int colFrom = csm.getMinSelectionIndex();
int colTo = csm.getMaxSelectionIndex();
int anchorRow = selectionModel.getAnchorSelectionIndex();
int anchorCol = csm.getAnchorSelectionIndex();
((ExactTableModel) dataModel).copyCellToArea(anchorRow, anchorCol, rowFrom, rowTo, colFrom, colTo);
updateRows(rowFrom, rowTo);
requestFocus();
}
}
示例3: canEdit
import javax.swing.ListSelectionModel; //導入方法依賴的package包/類
public static boolean canEdit( ListSelectionModel selectionModel, DefaultListModel listModel ) {
boolean can = selectionModel.getMinSelectionIndex() == selectionModel.getMaxSelectionIndex()
&& selectionModel.getMinSelectionIndex() != -1;
if (can) {
ClassPathSupport.Item item = (ClassPathSupport.Item) listModel.get(selectionModel.getMinSelectionIndex());
can = item != null && item.canEdit();
}
return can;
}
示例4: valueChanged
import javax.swing.ListSelectionModel; //導入方法依賴的package包/類
@Override
@SuppressWarnings("unchecked")
public void valueChanged (ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
List<VCSStatusNode> selectedNodes = new ArrayList<VCSStatusNode>();
ListSelectionModel selection = table.getSelectionModel();
final TopComponent tc = (TopComponent) SwingUtilities.getAncestorOfClass(TopComponent.class, table);
int min = selection.getMinSelectionIndex();
if (min != -1) {
int max = selection.getMaxSelectionIndex();
for (int i = min; i <= max; i++) {
if (selection.isSelectedIndex(i)) {
int idx = table.convertRowIndexToModel(i);
selectedNodes.add(tableModel.getNode(idx));
}
}
}
final T[] nodeArray = selectedNodes.toArray((T[]) java.lang.reflect.Array.newInstance(tableModel.getItemClass(), selectedNodes.size()));
Mutex.EVENT.readAccess(new Runnable() {
@Override
public void run() {
File[] selectedFiles = new File[nodeArray.length];
for (int i = 0; i < nodeArray.length; ++i) {
selectedFiles[i] = nodeArray[i].getFile();
}
support.firePropertyChange(PROP_SELECTED_FILES, null, selectedFiles);
if (tc != null) {
tc.setActivatedNodes(nodeArray);
}
}
});
}
示例5: getSelectedIndices
import javax.swing.ListSelectionModel; //導入方法依賴的package包/類
private int[] getSelectedIndices() {
ListSelectionModel mdl = listClasses.getSelectionModel();
int min = mdl.getMinSelectionIndex();
int max = mdl.getMaxSelectionIndex();
int[] indices = new int[max - min + 1];
int ix = 0;
for (int i = mdl.getMinSelectionIndex(); i <= max; i++) {
if (mdl.isSelectedIndex(i)) {
indices[ix++] = i;
}
}
int[] result = new int[ix];
System.arraycopy(indices, 0, result, 0, ix);
return result;
}
示例6: copyCellDown
import javax.swing.ListSelectionModel; //導入方法依賴的package包/類
/**
* Copies the value of the anchor (focused) down to the end of its column
*/
void copyCellDown() {
stopEditing();
int anchorRow = selectionModel.getAnchorSelectionIndex();
ListSelectionModel csm = columnModel.getSelectionModel();
int colFrom = csm.getMinSelectionIndex();
int colTo = csm.getMaxSelectionIndex();
LDTableModel dm = (LDTableModel) dataModel;
for (int i = colFrom; i <= colTo; i++) {
dm.copyCellDown(anchorRow, i);
}
updateRows(anchorRow + 1, getRowCount());
}
示例7: fillCells
import javax.swing.ListSelectionModel; //導入方法依賴的package包/類
/**
* Fills in selected cells with values obtained evaluating <code>expr</code>
* @throws jmt.common.exception.ExpressionParseException if there were errors parsing expr
*/
void fillCells(String expr) throws ExpressionParseException {
stopEditing();
int rowFrom = selectionModel.getMinSelectionIndex();
int rowTo = selectionModel.getMaxSelectionIndex();
ListSelectionModel csm = columnModel.getSelectionModel();
int colFrom = csm.getMinSelectionIndex();
int colTo = csm.getMaxSelectionIndex();
((LDTableModel) dataModel).fillCells(expr, rowFrom, rowTo, colFrom, colTo);
}
示例8: canMoveDown
import javax.swing.ListSelectionModel; //導入方法依賴的package包/類
public static boolean canMoveDown( ListSelectionModel selectionModel, int modelSize ) {
int iMax = selectionModel.getMaxSelectionIndex();
return iMax != -1 && iMax < modelSize - 1;
}