Examples of ListSelectionModel


Examples of javax.swing.ListSelectionModel

        datatypeColumn.setCellEditor(new StringArrayComboBoxEditor(dataTypeStringList));

        TableColumn parameterNameCol = tblParameters.getColumnModel().getColumn(1);
        parameterNameCol.setPreferredWidth(190);
        scrollPane.setViewportView(tblParameters);
        ListSelectionModel selectionModel = tblParameters.getSelectionModel();
        selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

        selectionModel.addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                btnDeleteParameter.setEnabled(tblParameters.getSelectedRows().length > 0);
            }
View Full Code Here

Examples of javax.swing.ListSelectionModel

      addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {

          synchronized (ForecastingPanel.this) {
            if (!e.getValueIsAdjusting()) {
              ListSelectionModel lm = (ListSelectionModel)e.getSource();
              for (int j = e.getFirstIndex(); j <= e.getLastIndex(); j++) {
                if (lm.isSelectedIndex(j)) {
                  String name = m_history.getSelectedName();
                  updateMainTabs(name);
                }
              }
            }
View Full Code Here

Examples of javax.swing.ListSelectionModel

        showPopup(e);
      }

      private void showPopup(MouseEvent e) {
        if (e.isPopupTrigger()) {
          ListSelectionModel selectionModel = table.getSelectionModel();
          selectionModel.setSelectionInterval(table.rowAtPoint(e.getPoint()), table.rowAtPoint(e.getPoint()));
          ctxMenu.show(e.getComponent(), e.getX(), e.getY());
        }
      }
    });
View Full Code Here

Examples of javax.swing.ListSelectionModel

         * Set the selected indices to the JList {@inheritDoc}
         */
        public void dispatch()
        {
            JList list = (JList) getSource();
            ListSelectionModel selModel = list.getSelectionModel();
            int n = list.getModel().getSize();
            for (int i = 0; i < n; i++)
            {
                if (selModel.isSelectedIndex(i) != _selected.get(i))
                {
                    if (_selected.get(i))
                    {
                        selModel.addSelectionInterval(i, i);
                    } else
                    {
                        selModel.removeSelectionInterval(i, i);
                    }
                }
            }
        }
View Full Code Here

Examples of javax.swing.ListSelectionModel

        if (isInserting && !event.getValueIsAdjusting()) {
            DatasetEditorModelRow insertRow = getInsertRow();
            if (insertRow != null) {
                int index = insertRow.getIndex();

                ListSelectionModel listSelectionModel = (ListSelectionModel) event.getSource();
                int selectionIndex = listSelectionModel.getLeadSelectionIndex();

                if (index != selectionIndex) {
                    //postInsertRecord();
                }
            }
View Full Code Here

Examples of javax.swing.ListSelectionModel

        componentsTable = createTable();
        capabilityScrollPane.setViewportView(componentsTable);

        // Listen for selections on the table, and when a row is selected then
        // enable the OK button (or not)
        ListSelectionModel selectionModel = componentsTable.getSelectionModel();
        selectionModel.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                boolean isEnabled = componentsTable.getSelectedRow() != -1;
                okButton.setEnabled(isEnabled);
            }
        });
View Full Code Here

Examples of javax.swing.ListSelectionModel

          if (bypassScrollSelection && scroll && table.getRowCount() > 0) {
            preferenceModel.setScrollToBottom(false);
          }
          previousLastIndex = evt.getLastIndex();

          final ListSelectionModel lsm = (ListSelectionModel) evt.getSource();

          if (lsm.isSelectionEmpty()) {
            if (isVisible()) {
              statusBar.setNothingSelected();
            }

            if (detail.getDocument().getDefaultRootElement() != null) {
View Full Code Here

Examples of javax.swing.ListSelectionModel

            }*/
          }
        }
      });

      final ListSelectionModel selectionModel = _detectorsTable.getSelectionModel();
      selectionModel.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(final ListSelectionEvent e) {
          if (!e.getValueIsAdjusting() && _detectorsTable.getSelectedRow() > -1) {
            final int modelIndex = _tableSorter.modelIndex(_detectorsTable.getSelectedRow());
            final DetectorFactory detectorFactory = _bugPatternModel.getEntries().get(modelIndex);
            final String description = getDetailedText(detectorFactory);
            getTextArea().setText(description);
            SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                getTextArea().scrollRectToVisible(new Rectangle(0, 0));
              }
            });
          }
        }
      });

      populateAvailableRulesTable();
      _tableSorter.setTableHeader(_detectorsTable.getTableHeader());
      _tableSorter.setSortingStatus(1, TableSorter.ASCENDING);
      TableSorter.makeSortable(_detectorsTable);

      _detectorsTable.setCellSelectionEnabled(false);
      _detectorsTable.setRowSelectionAllowed(true);
      _detectorsTable.getColumnModel().getColumn(0).setPreferredWidth(30);
      _detectorsTable.getColumnModel().getColumn(1).setPreferredWidth(350);
      _detectorsTable.getColumnModel().getColumn(2).setPreferredWidth(100);
      _detectorsTable.getColumnModel().getColumn(4).setPreferredWidth(400);
      _detectorsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
      selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      if (_detectorsTable.getModel().getRowCount() > 0) {
        selectionModel.setSelectionInterval(0, 0);
      }
    }
    return _detectorsTable;
  }
View Full Code Here

Examples of javax.swing.ListSelectionModel

        //to statusBar

        if (mainTable.getColumnSelectionAllowed()) {

            mainTable.setColumnSelectionAllowed(true);
            ListSelectionModel colSM =
                    mainTable.getColumnModel().getSelectionModel();
            colSM.addListSelectionListener(new ListSelectionListener() {

                @Override
                public void valueChanged(ListSelectionEvent e) {
                    //Ignore extra messages.
                    if (e.getValueIsAdjusting()) {
                        return;
                    }

                    ListSelectionModel lsm = (ListSelectionModel) e.getSource();
                    if (lsm.isSelectionEmpty()) {
                        statusBar.setMessage("No columns are selected.");
                    } else {
                        selectedColIndex = lsm.getMinSelectionIndex();
                        statusBar.setMessage("Column " + selectedColIndex + " is now selected." + "(" + columnStatus.get(selectedColIndex) + ")");
                    }
                }
            });
        }
View Full Code Here

Examples of javax.swing.ListSelectionModel

        JTable nodeTable = new JTable(tableModel);
        JScrollPane scrollPane = new JScrollPane(nodeTable);
        //nodeTable.setFillsViewportHeight(true);
        nodeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        ListSelectionModel lsm = nodeTable.getSelectionModel();
        lsm.addListSelectionListener(this);
        tableModel.addTableModelListener(new PubsubTableModelListener(pcm));

        JButton create = new JButton("Create node");
        create.setActionCommand("create");
        create.addActionListener(new PubsubCreateButtonListener(frame, pcm));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.