Package javax.swing

Examples of javax.swing.ListSelectionModel


            setupListAnchor();
        }

        private void setupListAnchor() {
            ListSelectionModel selectionModel = getViewRepresentation().getSelectionModel();

            int selectionAnchor = selectionModel.getLeadSelectionIndex();
            selectionModel.clearSelection();
            if (selectionAnchor >= 0 && selectionAnchor < getModel().getSize()) {
                selectionModel.setAnchorSelectionIndex(selectionAnchor);
                selectionModel.setLeadSelectionIndex(selectionAnchor);
            }
        }
View Full Code Here


     */
    private class FilteredSelectionAdapter extends DefaultTreeSelectionModel
            implements ListSelectionListener {

        public FilteredSelectionAdapter() {
            ListSelectionModel lsm = new DefaultListSelectionModel();
            lsm.addListSelectionListener(this);
            JFilterableTreeTable.this.setSelectionModel(lsm);
            getTree().setSelectionModel(this);
        }
View Full Code Here

      public Object getElementAt(int i) {
        return names[i];
      }
    });
    pList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    ListSelectionModel listSelectionModel = pList.getSelectionModel();
    listSelectionModel.addListSelectionListener(new pListSelectionListener());
    pListPane.setViewportView(pList);

    fileList.setFont(new java.awt.Font("Tahoma", 0, 9));
    fileList.setModel(new javax.swing.AbstractListModel() {
      /**
 
View Full Code Here

    public void valueChanged(ListSelectionEvent e) {

      if(!e.getValueIsAdjusting()) {

        ListSelectionModel lsm = (ListSelectionModel) e.getSource();
        int minIndex = lsm.getMinSelectionIndex();
        int maxIndex = lsm.getMaxSelectionIndex();

        for(int i = minIndex; i <= maxIndex; i++) {
          if(lsm.isSelectedIndex(i)) {
            org.jdom.Element elem = (org.jdom.Element) xmlList.get(i);
           
            String pluginName = elem.getAttributeValue("Name");
            String authorName = elem.getAttributeValue("Author");
            String pluginVersion = elem.getAttributeValue("PluginVersion");
View Full Code Here

    constraints.weightx = 1;
    add(buttonCWCheckWhiteLists, constraints);
    constraints.gridy++;

    // Select errors that can be fixed by bot
    ListSelectionModel selectionModel = tableCWAutomaticFixing.getSelectionModel();
    selectionModel.clearSelection();
    for (int i = 0; i < modelCWAutomaticFixing.getRowCount(); i++) {
      if (modelCWAutomaticFixing.isBotAlgorithm(i)) {
        selectionModel.addSelectionInterval(i, i);
      }
    }
  }
View Full Code Here

        }
        return indicesVecinos.substring(0, indicesVecinos.length() - 1);
    }

    private void seleccionUsuario() {
        ListSelectionModel fila = tablaCoordenadas.getSelectionModel();
        System.out.println("filaseleccionada: " + fila.toString());
        fila.addListSelectionListener(new ListSelectionListener() {

            public void valueChanged(ListSelectionEvent e) {
                ListSelectionModel lis = (ListSelectionModel) e.getSource();

                if (lis.isSelectionEmpty()) {
                } else {
                    int seleccionfila = lis.getMinSelectionIndex();
                    Vector vectorDato = obtenerVector(seleccionfila);
                    numeroTxt.setText(vectorDato.get(0).toString());
                    denominacion1.setText(vectorDato.get(1).toString());
                    coordenadax.setText(vectorDato.get(2).toString());
                    coordenaday.setText(vectorDato.get(3).toString());
View Full Code Here

        }

        // flag is used to avoid a round trip while we are selecting the values
        selectingValues = true;
        try {
            ListSelectionModel selectionModel = getList().getSelectionModel();
            selectionModel.setValueIsAdjusting(true);
            try {
                int[] valueIndexes = determineValueIndexes(selectedValues);
                int selectionMode = getSelectionMode();
                if (selectionMode == ListSelectionModel.SINGLE_SELECTION && valueIndexes.length > 1) {
                    getList().setSelectedIndex(valueIndexes[0]);
                } else {
                    getList().setSelectedIndices(valueIndexes);
                }

                // update value model if selectedValues contain elements which where not found in the list model
                // elements
                if (valueIndexes.length != selectedValues.length && !isReadOnly() && isEnabled()
                        || (selectionMode == ListSelectionModel.SINGLE_SELECTION && valueIndexes.length > 1)) {
                    updateSelectedItemsFromSelectionModel();
                }
            } finally {
                selectionModel.setValueIsAdjusting(false);
            }
        } finally {
            selectingValues = false;
        }
    }
View Full Code Here

            setupListAnchor();
        }

        private void setupListAnchor() {
            ListSelectionModel selectionModel = getViewRepresentation().getSelectionModel();

            int selectionAnchor = selectionModel.getLeadSelectionIndex();
            selectionModel.clearSelection();
            if (selectionAnchor >= 0 && selectionAnchor < getModel().getSize()) {
                selectionModel.setAnchorSelectionIndex(selectionAnchor);
                selectionModel.setLeadSelectionIndex(selectionAnchor);
            }
        }
View Full Code Here

            listener.connections.add(this);
            inputText = new JTextArea(null, null, 20, 80);
            inputScroll = new JScrollPane(inputText);
            outputText = new JTextArea(null, null, 20, 80);
            outputScroll = new JScrollPane(outputText);
            ListSelectionModel lsm = listener.connectionTable.getSelectionModel();
            if ((count == 0) || (lsm.getLeadSelectionIndex() == 0)) {
                listener.outPane.setVisible(false);
                int divLoc = listener.outPane.getDividerLocation();
                listener.setLeft(inputScroll);
                listener.setRight(outputScroll);
                listener.removeButton.setEnabled(false);
View Full Code Here

        TableColumn col;
        col = connectionTable.getColumnModel().getColumn(TCPMon.STATE_COLUMN);
        col.setMaxWidth(col.getPreferredWidth() / 2);
        col = connectionTable.getColumnModel().getColumn(TCPMon.REQ_COLUMN);
        col.setPreferredWidth(col.getPreferredWidth() * 2);
        ListSelectionModel sel = connectionTable.getSelectionModel();
        sel.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent event) {
                if (event.getValueIsAdjusting()) {
                    return;
                }
                ListSelectionModel m =
                        (ListSelectionModel) event.getSource();
                int divLoc = outPane.getDividerLocation();
                if (m.isSelectionEmpty()) {
                    setLeft(
                            new JLabel(
                                    " "
                            +
                            TCPMon.getMessage("wait00",
                                    "Waiting for Connection...")));
                    setRight(new JLabel(""));
                    removeButton.setEnabled(false);
                    removeAllButton.setEnabled(false);
                    saveButton.setEnabled(false);
                    resendButton.setEnabled(false);
                } else {
                    int row = m.getLeadSelectionIndex();
                    if (row == 0) {
                        if (connections.size() == 0) {
                            setLeft(
                                    new JLabel(
                                            " "
View Full Code Here

TOP

Related Classes of javax.swing.ListSelectionModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.