Package javax.swing.table

Examples of javax.swing.table.DefaultTableColumnModel


        });
    }

    public void testGetSetColumnModel() throws Exception {
        table = new JTable(3, 4);
        DefaultTableColumnModel oldModel = (DefaultTableColumnModel) table.getColumnModel();
        assertNotNull(oldModel);
        assertEquals(2, oldModel.getColumnModelListeners().length);
        assertEquals(table.getTableHeader(), oldModel.getColumnModelListeners()[0]);
        assertEquals(table, oldModel.getColumnModelListeners()[1]);
        DefaultTableColumnModel model = new DefaultTableColumnModel();
        table.setColumnModel(model);
        assertEquals(0, oldModel.getColumnModelListeners().length);
        assertEquals(2, model.getColumnModelListeners().length);
        assertEquals(0, table.getColumnModel().getColumnCount());
        assertFalse(propertyChangeController.isChanged());
        testExceptionalCase(new IllegalArgumentCase() {
            @Override
            public void exceptionalAction() throws Exception {
View Full Code Here


        super(name);
    }

    @Override
    protected void setUp() throws Exception {
        event = new TableColumnModelEvent(new DefaultTableColumnModel(), 5, 10);
    }
View Full Code Here

    public void testTableColumnModelEvent() throws Exception {
        assertTrue(event.getSource() instanceof DefaultTableColumnModel);
        assertEquals(5, event.getFromIndex());
        assertEquals(10, event.getToIndex());
        event = new TableColumnModelEvent(new DefaultTableColumnModel(), 10, 5);
        assertEquals(10, event.getFromIndex());
        assertEquals(5, event.getToIndex());
    }
View Full Code Here

    }
  }
 
  public static void packColumn(JTable table, int vColIndex, int margin){
    TableModel model = table.getModel();
    DefaultTableColumnModel colModel =
      (DefaultTableColumnModel)table.getColumnModel();
    TableColumn col = colModel.getColumn(vColIndex);
    int width = 0;
   
    /*
    TableCellRenderer renderer = col.getHeaderRenderer();
    if (renderer == null)
View Full Code Here

        Point point = serverMonitor.getMainMonitorGUI().getLocation();
        setLocation(point.x + 20, point.y + 20);
        setSize(500, 300);

        DefaultTableColumnModel defaultColumn = (DefaultTableColumnModel) activityTable.getColumnModel();

        defaultColumn.getColumn(0).setResizable(false);
        defaultColumn.getColumn(0).setPreferredWidth(120);
        defaultColumn.getColumn(0).setMaxWidth(120);

        defaultColumn = (DefaultTableColumnModel) detailsTable.getColumnModel();
        defaultColumn.getColumn(0).setPreferredWidth(120);
        defaultColumn.getColumn(0).setMaxWidth(250);

        setVisible(true);

        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
View Full Code Here

        DefaultTableModel model = new DefaultTableModel();
        table = new JTable(model);
        assertSame(model, table.dataModel);
        assertSame(DefaultTableColumnModel.class, table.columnModel.getClass());
        assertSame(DefaultListSelectionModel.class, table.selectionModel.getClass());
        DefaultTableColumnModel columnModel = new DefaultTableColumnModel();
        table = new JTable(model, columnModel);
        assertSame(model, table.dataModel);
        assertSame(columnModel, table.columnModel);
        assertSame(DefaultListSelectionModel.class, table.selectionModel.getClass());
        DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
View Full Code Here

        });
    }

    public void testGetSetColumnModel() throws Exception {
        table = new JTable(3, 4);
        DefaultTableColumnModel oldModel = (DefaultTableColumnModel) table.getColumnModel();
        assertNotNull(oldModel);
        assertEquals(2, oldModel.getColumnModelListeners().length);
        assertEquals(table.getTableHeader(), oldModel.getColumnModelListeners()[0]);
        assertEquals(table, oldModel.getColumnModelListeners()[1]);
        DefaultTableColumnModel model = new DefaultTableColumnModel();
        table.setColumnModel(model);
        assertEquals(0, oldModel.getColumnModelListeners().length);
        assertEquals(2, model.getColumnModelListeners().length);
        assertEquals(0, table.getColumnModel().getColumnCount());
        assertFalse(propertyChangeController.isChanged());
        testExceptionalCase(new IllegalArgumentCase() {
            @Override
            public void exceptionalAction() throws Exception {
View Full Code Here

    /** Creates new form JInventoryLines */
    public JInventoryLines() {
       
        initComponents();
       
        DefaultTableColumnModel columns = new DefaultTableColumnModel();
        TableColumn c;
       
        c = new TableColumn(0, 200
                , new DataCellRenderer(javax.swing.SwingConstants.LEFT)
                , new DefaultCellEditor(new JTextField()));
        c.setHeaderValue(AppLocal.getIntString("label.item"));
        columns.addColumn(c);
        c = new TableColumn(1, 75
                , new DataCellRenderer(javax.swing.SwingConstants.RIGHT)
                , new DefaultCellEditor(new JTextField()));
        c.setHeaderValue(AppLocal.getIntString("label.units"));
        columns.addColumn(c);
        c = new TableColumn(2, 75
                , new DataCellRenderer(javax.swing.SwingConstants.RIGHT)
                , new DefaultCellEditor(new JTextField()));
        c.setHeaderValue(AppLocal.getIntString("label.price"));
        columns.addColumn(c);
       
        m_tableinventory.setColumnModel(columns);      
       
        m_tableinventory.getTableHeader().setReorderingAllowed(false);        
        m_tableinventory.setRowHeight(40);
View Full Code Here

        int margin = 5;

        for (int i = 0; i < table.getColumnCount(); i++) {
            int                     vColIndex = i;
            DefaultTableColumnModel colModel  = (DefaultTableColumnModel) table.getColumnModel();
            TableColumn             col       = colModel.getColumn(vColIndex);
            int                     width     = 0;

            // Get width of column header
            TableCellRenderer renderer = col.getHeaderRenderer();
View Full Code Here

        String[] resultVectorTableColumnNames = {"Key",
                                                 "DataObject",
                                                 "Core-Distance",
                                                 "Reachability-Distance"};

        DefaultTableColumnModel resultVectorTableColumnModel = new DefaultTableColumnModel();
        for (int i = 0; i < resultVectorTableColumnNames.length; i++) {
            TableColumn tc = new TableColumn(i);
            tc.setHeaderValue(resultVectorTableColumnNames[i]);
            resultVectorTableColumnModel.addColumn(tc);
        }

        ResultVectorTableModel resultVectorTableModel;
        if (serObject != null)
          resultVectorTableModel = new ResultVectorTableModel(serObject.getResultVector());
View Full Code Here

TOP

Related Classes of javax.swing.table.DefaultTableColumnModel

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.