Java Code Examples for javax.swing.ListSelectionModel#SINGLE_INTERVAL_SELECTION

The following examples show how to use javax.swing.ListSelectionModel#SINGLE_INTERVAL_SELECTION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JTableSelectionModelEditor.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Node storeToXML(Document doc) {
    Object value = getValue();
    int selectionMode = -1;
    Object[] values = getEnumerationValues();
    if (values[4].equals(value)) {
        selectionMode = ListSelectionModel.SINGLE_SELECTION;
    } else if (values[7].equals(value)) {
        selectionMode = ListSelectionModel.SINGLE_INTERVAL_SELECTION;
    } else if (values[10].equals(value)) {
        selectionMode = ListSelectionModel.MULTIPLE_INTERVAL_SELECTION;
    }
    org.w3c.dom.Element el = null;
    el = doc.createElement(XML_TABLE_SELECTION_MODEL);
    el.setAttribute(ATTR_SELECTION_MODE, Integer.toString(selectionMode));
    return el;
}
 
Example 2
Source File: JTableSelectionModelEditor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void readFromXML(Node element) throws IOException {
    org.w3c.dom.NamedNodeMap attributes = element.getAttributes();
    Object[] values = getEnumerationValues();
    Object value;
    Node node = attributes.getNamedItem(ATTR_SELECTION_MODE);
    int selectionMode = Integer.valueOf(node.getNodeValue()).intValue();
    switch (selectionMode) {
        case ListSelectionModel.SINGLE_SELECTION: value = values[4]; break;
        case ListSelectionModel.SINGLE_INTERVAL_SELECTION: value = values[7]; break;
        case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION: value = values[10]; break;
        default: value = values[1]; break;
    }
    setValue(value);
}
 
Example 3
Source File: ListBoxBuilder.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
public ListBoxBuilder<T> singleIntervalSelectionMode() {
   this.selectionMode = ListSelectionModel.SINGLE_INTERVAL_SELECTION;
   return this;
}