Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
import javax.swing.DefaultListSelectionModel;
public class MyClass extends DefaultListSelectionModel{
int maxSelectableRows;
public MyClass (int maxSelectableRows){
this.maxSelectableRows = maxSelectableRows;
}
/* (non-Javadoc)
* @see javax.swing.DefaultListSelectionModel#addSelectionInterval(int, int)
*/
@Override
public void addSelectionInterval(int index0, int index1) {
int numberOfSelectedRows = 0;
for (int i = getMinSelectionIndex(); i <= getMaxSelectionIndex(); i++) {
if (isSelectedIndex(i)) {
numberOfSelectedRows++;
}
}
if (numberOfSelectedRows > maxSelectableRows) {
return;
}
super.addSelectionInterval(index0, index1);
}
/* (non-Javadoc)
* @see javax.swing.DefaultListSelectionModel#setSelectionInterval(int, int)
*/
@Override
public void setSelectionInterval(int index0, int index1) {
int min = Math.min(index0, index1);
int max = Math.max(index0, index1);
if ((max - min) > maxSelectableRows) {
return;
}
super.setSelectionInterval(index0, index1);
}
}