Examples of ListSelectionModel


Examples of javax.swing.ListSelectionModel

                public void valueChanged(ListSelectionEvent e) {
                    // Ignore extra messages.
                    if (e.getValueIsAdjusting()) {
                        return;
                    }
                    ListSelectionModel lsm2 = (ListSelectionModel) e.getSource();
                    if (lsm2.isSelectionEmpty()) {
                        // no rows are selected
                    } else {
                        int index = lsm2.getMinSelectionIndex();
                        selectGraphic(index);
                        getComponent().repaint();
                    }
                }
            });
View Full Code Here

Examples of javax.swing.ListSelectionModel

        DbfTableModel model = layer.getModel();
        JTable table = new JTable(model);
        JScrollPane pane = new JScrollPane(table);
        frame.getContentPane().add(pane, BorderLayout.CENTER);

        ListSelectionModel lsm = table.getSelectionModel();
        lsm.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                //Ignore extra messages.
                if (e.getValueIsAdjusting()) {
                    return;
                }
                ListSelectionModel lsm2 = (ListSelectionModel) e.getSource();
                if (lsm2.isSelectionEmpty()) {
                    //no rows are selected
                } else {
                    int index = lsm2.getMinSelectionIndex();
                    EsriGraphicList list = layer.getEsriGraphicList();
                    OMGraphic graphic = list.getOMGraphicAt(index);
                    graphic.select();
                    list.generate(_mapBean.getProjection());
                    layer.repaint();
View Full Code Here

Examples of javax.swing.ListSelectionModel

        public Object getValueAt(int row, int col) { return ((FileFilter)filterList.get(row)).getDescription(); }
      };
      JTable table = new JTable(dataModel);

      table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      ListSelectionModel rowSM = table.getSelectionModel();
      rowSM.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
          //Ignore extra messages.
          if (e.getValueIsAdjusting()) return;
       
          ListSelectionModel lsm = (ListSelectionModel)e.getSource();
          if (lsm.isSelectionEmpty()) {
            //no rows are selected
          } else {
            chosenIndex = lsm.getMinSelectionIndex();
            SelectFileFilterDialog.this.dispose();
          }
        }
      });
View Full Code Here

Examples of javax.swing.ListSelectionModel

  /**
   * Updates selected furniture in table from <code>selectedItems</code>.
   */
  private void updateTableSelectedFurniture(List<Selectable> selectedItems) {
    ListSelectionModel selectionModel = getSelectionModel();
    selectionModel.removeListSelectionListener(this.tableSelectionListener);

    FurnitureTableModel tableModel = (FurnitureTableModel)getModel();
    int minIndex = Integer.MAX_VALUE;
    int maxIndex = Integer.MIN_VALUE;
    int [] furnitureIndices = new int [selectedItems.size()];
View Full Code Here

Examples of javax.swing.ListSelectionModel

     * (overridden)
     *
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
     */
    public void actionPerformed(ActionEvent e) {
        ListSelectionModel model = targetTable.getSelectionModel();
        //        int[] indices = targetTable.getSelectedRows();
        int leading = model.getLeadSelectionIndex();
        if (leading != -1) {
            if (upWards) {
                if (leading > 0) {
                    model.removeSelectionInterval(leading, leading);
                    model.addSelectionInterval(leading - 1, leading - 1);
                    model.setLeadSelectionIndex(leading - 1);
                    //                    if (!performExtension)
                    //                        model.removeIndexInterval(leading, leading);
                    scrollToLead();
                }
            } else {
                if (leading < targetTable.getRowCount() - 1) {
                    model.removeSelectionInterval(leading, leading);
                    model.addSelectionInterval(leading + 1, leading + 1);
                    model.setLeadSelectionIndex(leading + 1);
                    //                    if (!performExtension)
                    //                        model.removeIndexInterval(leading, leading);
                    scrollToLead();
                }
            }
View Full Code Here

Examples of javax.swing.ListSelectionModel

    setDefaultRenderer(Date.class,
           new DateCellRenderer("HH:mm:ss, MMM dd"));
   
    setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    ListSelectionModel rowSM = getSelectionModel();

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

    if (e.getValueIsAdjusting()) {
      return;
    }

    ListSelectionModel lsm = (ListSelectionModel)e.getSource();

    if (lsm.isSelectionEmpty()) {
      //
    } else {     
            int ix = lsm.getMinSelectionIndex();

      ExtLogEntry entry = JLogTable.this.model.getEntry(ix);

      if(entry != null) {
        JLogTable.this.logEntryDetail.setParentAndEntry(JLogTable.this, entry);
View Full Code Here

Examples of javax.swing.ListSelectionModel

        topHalf.add( listContainer );

        //Create JList for items, add to scroll pane and then add to parent
        // container
        JList list = new JList( items );
        ListSelectionModel listSelectionModel = list.getSelectionModel( );
        listSelectionModel
                          .setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
        //handler adds item to shopping cart
        list.addMouseListener( new ListSelectionHandler( ) );
        JScrollPane listPane = new JScrollPane( list );
        listContainer.add( listPane );

        JPanel tableContainer = new JPanel( new GridLayout( 1, 1 ) );
        tableContainer.setBorder( BorderFactory.createTitledBorder( "Table" ) );
        topHalf.add( tableContainer );

        //Container that displays table showing items in cart
        tableModel = new TableModel( );
        JTable table = new JTable( tableModel );
        //handler removes item to shopping cart
        table.addMouseListener( new TableSelectionHandler( ) );
        ListSelectionModel tableSelectionModel = table.getSelectionModel( );
        tableSelectionModel
                           .setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
        TableColumnModel tableColumnModel = table.getColumnModel( );
        //notice we have a custom renderer for each column as both columns
        // point to the same underlying object
        tableColumnModel.getColumn( 0 ).setCellRenderer( new NameRenderer( ) );
View Full Code Here

Examples of javax.swing.ListSelectionModel

        {
            public void valueChanged(ListSelectionEvent ev)
            {
                if (!ev.getValueIsAdjusting())
                {
                    ListSelectionModel lsm = (ListSelectionModel)ev.getSource();
                    if (!lsm.isSelectionEmpty())
                    {
                        if (Main.m_settings.isDebug())
                            System.err.println("Table selection changed");
                        if (m_imgDisplayTimer.getDelay() == 0)
                            doSetImg();
View Full Code Here

Examples of javax.swing.ListSelectionModel

        }
    }
   
    public void doSetImg()
    {
        ListSelectionModel lsm = m_table.getSelectionModel();
        int row = lsm.getMinSelectionIndex();
        JIfdData data = m_tableData.getRowData(row);
        if (!m_slideshowTimer.isRunning())
            doSetPreload(row);
        m_imgView.setJpg(data);
    }
View Full Code Here

Examples of javax.swing.ListSelectionModel

        }
    }
   
    public void selectNextItem(boolean bUp)
    {
        ListSelectionModel lsm = m_table.getSelectionModel();
        int row = lsm.getMinSelectionIndex();
        if (row >= 0)
        {
            if (bUp) row--;
            else row++;
            if (row >= 0 && row < m_tableData.getRowCount())
                lsm.setSelectionInterval(row, row);
        }
    }
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.