Package javax.swing.event

Examples of javax.swing.event.TableModelListener


    /***
     * Add a model table listener to the current model
     */
    private void addModelListenerToCurrentModel() {

        this.model.addTableModelListener(new TableModelListener() {

            public void tableChanged(TableModelEvent tme) {
                int firstRow = tme.getFirstRow();
                int column = tme.getColumn();

View Full Code Here


    /***
     * Add a model table listener to the current model
     */
    private void addModelListenerToCurrentModel() {

        this.model.addTableModelListener(new TableModelListener() {

            public void tableChanged(TableModelEvent tme) {
                int firstRow = tme.getFirstRow();
                int column = tme.getColumn();

View Full Code Here

        setLayout(new BorderLayout());
        tableModel = new TableModel(modelPreferences);
        table = new JTableX(tableModel);
        table.setRowSelectionAllowed(false);
        table.setColumnSelectionAllowed(false);
        tableModel.addTableModelListener(new TableModelListener() {
            public void tableChanged(TableModelEvent e) {
                TableModel tempModel = (TableModel) e.getSource();
                String name = (String) (tempModel).getValueAt(e.getFirstRow(),
                        TableModel.SALSA_MODEL);
                if (name.equalsIgnoreCase("ScanServer")) {
View Full Code Here

        tableModel = new PluginTableModel(modelPreferences);
        table = new JTable(tableModel);
        JScrollPane jsp = new JScrollPane(table);
        add(jsp, BorderLayout.CENTER);

        tableModel.addTableModelListener(new TableModelListener() {

            public void tableChanged(TableModelEvent e) {
                PluginTableModel tempModel = (PluginTableModel) e.getSource();
                String name = (String) (tempModel).getValueAt(e.getFirstRow(),
                        TableModel.SALSA_MODEL);
View Full Code Here

    /***
     * Add a model table listener to the current model
     */
    private void addModelListenerToCurrentModel() {

        this.model.addTableModelListener(new TableModelListener() {

            public void tableChanged(TableModelEvent tme) {
                int firstRow = tme.getFirstRow();
                int column = tme.getColumn();

View Full Code Here

                }
            }
            tableModel.setDataVector(rows, columns);
            mainTable.setModel(tableModel);
            mainTable.getColumnModel().getColumn(0).setCellRenderer(new MyTableColumnRenderer());
            mainTable.getModel().addTableModelListener(new TableModelListener() {
               
                public void tableChanged(TableModelEvent event) {
                    tableChangedEvent(event);
                }
            });
View Full Code Here

            //...and that the model hasn't been altered
            Assert.assertEquals(2, model.getRowCount());
        }
       
        //Create some mock listeners and add them to the model
        TableModelListener listener1 = (TableModelListener) EasyMock.createMock(TableModelListener.class);
        TableModelListener listener2 = (TableModelListener) EasyMock.createMock(TableModelListener.class);
        model.addTableModelListener(listener1);
        model.addTableModelListener(listener2);
       
        //For the next test, remove the first row and confirm that the model now contains only one row and that the
        //listeners were notified correctly
       
        //Create the expected event
        TableModelEvent expectedEvent = new TableModelEvent(model,
                                                            0,
                                                            0,
                                                            TableModelEvent.ALL_COLUMNS,
                                                            TableModelEvent.DELETE);
       
        //set the expectations on the listeners and switch them to replay mode
        listener1.tableChanged(matchEvent(expectedEvent));
        listener2.tableChanged(matchEvent(expectedEvent));
        EasyMock.replay(listener1);
        EasyMock.replay(listener2);
       
        //execute the test
        model.remove(0);
View Full Code Here

            //...and that the model has not been altered
            Assert.assertEquals(4, model.getRowCount());
        }
       
        //Create some mock listeners and add them to the model
        TableModelListener listener1 = (TableModelListener) EasyMock.createMock(TableModelListener.class);
        TableModelListener listener2 = (TableModelListener) EasyMock.createMock(TableModelListener.class);
        model.addTableModelListener(listener1);
        model.addTableModelListener(listener2);
       
        //For the next test, remove the second and third rows and confirm that the model now
        //contains only two rows and that the listeners were notified correctly
       
        //Create the expected event
        TableModelEvent expectedEvent = new TableModelEvent(model,
                                                            1,
                                                            2,
                                                            TableModelEvent.ALL_COLUMNS,
                                                            TableModelEvent.DELETE);
       
        //set the expectations on the listeners and switch them to replay mode
        listener1.tableChanged(matchEvent(expectedEvent));
        listener2.tableChanged(matchEvent(expectedEvent));
        EasyMock.replay(listener1);
        EasyMock.replay(listener2);
       
        //execute the test
        model.remove(1, 2);
View Full Code Here

            //...and that the model has not been altered
            Assert.assertEquals(4, model.getRowCount());
        }
       
        //Create some mock listeners and add them to the model
        TableModelListener listener1 = (TableModelListener) EasyMock.createMock(TableModelListener.class);
        TableModelListener listener2 = (TableModelListener) EasyMock.createMock(TableModelListener.class);
        model.addTableModelListener(listener1);
        model.addTableModelListener(listener2);
       
        // confirm that an empty array has no effect on the model
       
View Full Code Here

       
        //confirm that the 4 rows were added
        Assert.assertEquals(4, model.getRowCount());
       
        //Create some mock listeners and add them to the model
        TableModelListener listener1 = (TableModelListener) EasyMock.createMock(TableModelListener.class);
        TableModelListener listener2 = (TableModelListener) EasyMock.createMock(TableModelListener.class);
        model.addTableModelListener(listener1);
        model.addTableModelListener(listener2);
       
        //Create the expected event
        TableModelEvent expectedEvent = new TableModelEvent(model);
       
        //set the expectations on the listeners and switch them to replay mode
        listener1.tableChanged(matchEvent(expectedEvent));
        listener2.tableChanged(matchEvent(expectedEvent));
        EasyMock.replay(listener1);
        EasyMock.replay(listener2);
       
        //execute the test
        model.clear();
View Full Code Here

TOP

Related Classes of javax.swing.event.TableModelListener

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.