Examples of ListSelectionModel


Examples of javax.swing.ListSelectionModel

        pcm.setPassword(passwordTxt.getText());
        pcm.setJID(jidTxt.getText());
    }

    public void valueChanged(ListSelectionEvent e) {
        ListSelectionModel lsm = (ListSelectionModel)e.getSource();
        if(e.getValueIsAdjusting()) {
            if(lsm.isSelectionEmpty()) {
                disableOpenButton();
                disableDeleteButton();
            } else {
                changeOpenButton();
                changeDeleteButton(e);
View Full Code Here

Examples of javax.swing.ListSelectionModel

            col.setMaxWidth( col.getPreferredWidth() / 2 );
            col = connectionTable.getColumnModel().getColumn(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(" " + 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(" " + getMessage("wait00", "Waiting for connection...")));
                                    setRight(new JLabel(""));
View Full Code Here

Examples of javax.swing.ListSelectionModel

                e.printStackTrace();
            }
        }

        public void remove() {
            ListSelectionModel lsm = connectionTable.getSelectionModel();
            int bot = lsm.getMinSelectionIndex();
            int top = lsm.getMaxSelectionIndex();

            for ( int i = top ; i >= bot ; i-- ) {
                ((Connection) connections.get(i - 1)).remove();
            }
            if ( bot > connections.size() ) bot = connections.size();
            lsm.setSelectionInterval(bot, bot);
        }
View Full Code Here

Examples of javax.swing.ListSelectionModel

            if ( bot > connections.size() ) bot = connections.size();
            lsm.setSelectionInterval(bot, bot);
        }

        public void removeAll() {
            ListSelectionModel lsm = connectionTable.getSelectionModel();
            lsm.clearSelection();
            while ( connections.size() > 0 )
                ((Connection) connections.get(0)).remove();

            lsm.setSelectionInterval(0, 0);
        }
View Full Code Here

Examples of javax.swing.ListSelectionModel

            if ( rc == JFileChooser.APPROVE_OPTION ) {
                try {
                    File             file = dialog.getSelectedFile();
                    FileOutputStream out  = new FileOutputStream( file );

                    ListSelectionModel lsm = connectionTable.getSelectionModel();

                    rc = lsm.getLeadSelectionIndex();
                    if ( rc == 0 ) rc = connections.size();
                    Connection conn = (Connection) connections.get( rc - 1 );

                    rc = Integer.parseInt( portField.getText() );
                    out.write( (new String(getMessage("listenPort01", "Listen Port:") + " " + rc + "\n" )).getBytes() );
View Full Code Here

Examples of javax.swing.ListSelectionModel

        public void resend() {
            int rc ;

            try {
                ListSelectionModel lsm = connectionTable.getSelectionModel();

                rc = lsm.getLeadSelectionIndex();
                if ( rc == 0 ) rc = connections.size();
                Connection conn = (Connection) connections.get( rc - 1 );

                if ( rc > 0 ) {
                    lsm.clearSelection();
                    lsm.setSelectionInterval(0, 0);
                }

                InputStream in = null ;
                String      text = conn.inputText.getText();
View Full Code Here

Examples of javax.swing.ListSelectionModel

                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 );
View Full Code Here

Examples of javax.swing.ListSelectionModel

    }


    public void valueChanged( ListSelectionEvent an_event )
    {
        ListSelectionModel selectionModel = ( ListSelectionModel ) an_event.getSource();
        int minIndex = selectionModel.getMinSelectionIndex();
        int maxIndex = selectionModel.getMaxSelectionIndex();

        for ( int ii = minIndex; ii <= maxIndex; ii++ )
        {
            if ( selectionModel.isSelectedIndex( ii ) && !an_event.getValueIsAdjusting() )
            {
                Long id = ( Long ) m_resultsTbl.getModel().getValueAt( ii, 0 );
                ( ( PartitionFrame ) getParent() ).selectTreeNode( id );
            }
        }
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

Examples of javax.swing.ListSelectionModel

        pcm.setPassword(passwordTxt.getText());
        pcm.setJID(jidTxt.getText());
    }

    public void valueChanged(ListSelectionEvent e) {
        ListSelectionModel lsm = (ListSelectionModel) e.getSource();
        if (e.getValueIsAdjusting()) {
            if (lsm.isSelectionEmpty()) {
                disableOpenButton();
                disableDeleteButton();
            } else {
                changeOpenButton();
                changeDeleteButton(e);
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.