Package javax.swing.table

Examples of javax.swing.table.TableColumn


        setLayout(Layout.getGBL());

        table = ComponentFactory.getDCTable(false, false);
        table.setColumnCount(5);

        TableColumn cModule = table.getColumnModel().getColumn(_COLUMN_MODULE);
        cModule.setHeaderValue(DcResources.getText("lblModule"));
       
        TableColumn cLabel = table.getColumnModel().getColumn(_COLUMN_LABEL);
        cLabel.setHeaderValue(DcResources.getText("lblField"));

        TableColumn cView = table.getColumnModel().getColumn(_COLUMN_VIEW);
        JCheckBox cbView = new JCheckBox();
        cbView.addActionListener(this);
        cbView.setActionCommand("applyRight");
        cView.setCellEditor(new DefaultCellEditor(cbView));
        cView.setCellRenderer(CheckBoxTableCellRenderer.getInstance());
        cView.setHeaderValue(DcResources.getText("lblViewRights"));

        TableColumn cEdit = table.getColumnModel().getColumn(_COLUMN_EDIT);
        JCheckBox cbEdit = new JCheckBox();
        cEdit.setCellEditor(new DefaultCellEditor(cbEdit));
        cbEdit.addActionListener(this);
        cbEdit.setActionCommand("applyRight");
        cEdit.setCellRenderer(CheckBoxTableCellRenderer.getInstance());
        cEdit.setHeaderValue(DcResources.getText("lblEditRights"));

        TableColumn cHidden = table.getColumnModel().getColumn(_COLUMN_PERMISSION);
       
        table.removeColumn(cHidden);
        table.removeColumn(cModule);
       
        // table
View Full Code Here


        DcLabel labelPredefined = ComponentFactory.getLabel(DcResources.getText("lblPredefinedFields"));
        DcLabel lebelFields = ComponentFactory.getLabel(update ? DcResources.getText("lblFields") : DcResources.getText("lblNewFields"));
       
        tableSysFields.setColumnCount(1);
        TableColumn colSysField = tableSysFields.getColumnModel().getColumn(0);
        colSysField.setCellEditor(new DefaultCellEditor(ComponentFactory.getTextFieldDisabled()));
        colSysField.setHeaderValue(DcResources.getText("lblName"));

        JScrollPane scrollerSysFields = new JScrollPane(tableSysFields);
        scrollerSysFields.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        scrollerSysFields.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
       
        table.setColumnCount(3);
        TableColumn colField = table.getColumnModel().getColumn(0);
        JTextField textField = ComponentFactory.getTextFieldDisabled();
        colField.setCellEditor(new DefaultCellEditor(textField));
        colField.setHeaderValue(DcResources.getText("lblName"));

        TableColumn colCanRemove = table.getColumnModel().getColumn(1);
       
        JCheckBox cb1 = ComponentFactory.getCheckBox("");
        cb1.setEnabled(false);
        colCanRemove.setCellEditor(new DefaultCellEditor(cb1));
        colCanRemove.setHeaderValue(DcResources.getText("lblCanBeRemoved"));
        colCanRemove.setCellRenderer(CheckBoxTableCellRenderer.getInstance());

        JCheckBox cb2 = ComponentFactory.getCheckBox("");
        cb2.setEnabled(false);
        TableColumn colCanChange = table.getColumnModel().getColumn(2);
        colCanChange.setCellEditor(new DefaultCellEditor(cb2));
        colCanChange.setHeaderValue(DcResources.getText("lblCanBeAltered"));
        colCanChange.setCellRenderer(CheckBoxTableCellRenderer.getInstance());
       
        JScrollPane scroller = new JScrollPane(table);
        scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        scroller.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
       
View Full Code Here

        tblAvailableItems = new DcTable(true, false);
        tblAvailableItems.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        tblAvailableItems.addMouseListener(new ListMouseListener(ListMouseListener._RIGHT));
       
        tblAvailableItems.setColumnCount(1);
        TableColumn cSimpleVal = tblAvailableItems.getColumnModel().getColumn(0);
        cSimpleVal.setCellRenderer(SimpleValueTableCellRenderer.getInstance());
        cSimpleVal.setHeaderValue(DcResources.getText("lblAvailable"));
       
        tblSelectedItems = new DcTable(true, false);
        tblSelectedItems.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        tblSelectedItems.addMouseListener(new ListMouseListener(ListMouseListener._LEFT));

        tblSelectedItems.setColumnCount(1);
        cSimpleVal = tblSelectedItems.getColumnModel().getColumn(0);
        cSimpleVal.setCellRenderer(SimpleValueTableCellRenderer.getInstance());
        cSimpleVal.setHeaderValue(DcResources.getText("lblSelected"));

        JScrollPane scrollerLeft = new JScrollPane(tblAvailableItems);
        scrollerLeft.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
        scrollerLeft.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
       
View Full Code Here

        JPanel panelExludeDirs = new JPanel();
        panelExludeDirs.setLayout(Layout.getGBL());

        tableSkipDirs = ComponentFactory.getDCTable(true, false);
        tableSkipDirs.setColumnCount(1);
        TableColumn columnDir = tableSkipDirs.getColumnModel().getColumn(0);
        JTextField textField = ComponentFactory.getTextFieldDisabled();
        columnDir.setCellEditor(new DefaultCellEditor(textField));
        columnDir.setHeaderValue(DcResources.getText("lblDirectory"));
       
        JPanel panelActions = new JPanel();
        buttonAdd = ComponentFactory.getButton(DcResources.getText("lblAdd"));
        buttonRemove = ComponentFactory.getButton(DcResources.getText("lblRemove"));
       
View Full Code Here

    return  table;
  }
 
  protected JTable createPropertyCheckBoxTableDataPanel(PropertyData propertyData, PropertyData propertyDataCopy){
    JTable table=new JTable(new PropertyBooleanTableModel( dstree, propertyDataCopy));
    TableColumn c;
    c=table.getColumn("2");
    c.setPreferredWidth(10);
    c=table.getColumn("3");
    return  table;
  }
View Full Code Here

      // check if content is big enough to require
      // dedicated display in the descWindow
      String text=(String) table.getModel().getValueAt(row, col);
      int cr=text.indexOf('\n');
      if(cr<0){
        TableColumn tc=table.getColumnModel().getColumn(
            table.columnAtPoint(e.getPoint()));
        if(table.getTextWidth(text)<tc.getWidth()){
          return; // one line with not enough chars
        }
      }
      descArea.setText(text);
      Point p = table.getLocationOnScreen();
View Full Code Here

 
 
  protected JTable createTableDataPanel(SceneGraphData dataCopy){
    TransformTableModel transformTableModel = new TransformTableModel(dstree,  (TransformData)dataCopy);
    JTable table=new JTable(transformTableModel);
    TableColumn c;
    c=table.getColumn("2");
    c.setPreferredWidth(10);
    c=table.getColumn("3");
    return  table;
  }
View Full Code Here

            //Need to get the column that is concerned by the filter changement.
            //Because column order may have changed.
            String columnName = tableModel.getColumnName(columnIndex);
            String columnFilteredName = "*"+columnName+"*";
            Enumeration columns = tableHeader.getColumnModel().getColumns();
            TableColumn concernedColumn = null;
            while (columns.hasMoreElements()) {
                TableColumn  column = (TableColumn) columns.nextElement();
                String columnHeaderValue = (String) column.getHeaderValue();
                if (columnHeaderValue.equals(columnName) ||  columnHeaderValue.equals(columnFilteredName)){
                    concernedColumn = column;
                }
            }
            //change the header foreground with filtering status
View Full Code Here

    return p;
  }
 
  protected JTable createPropertyTableDataPanel(PropertyData propertyData, PropertyData propertyDataCopy){
    JTable table=new JTable(new PropertyTableModel( dstree, propertyDataCopy));
    TableColumn c;
    c=table.getColumn("2");
    c.setPreferredWidth(10);
    c=table.getColumn("3");
    return  table;
  }
View Full Code Here

    // margin pixels are added to the left and right
    // (resulting in an additional width of 2*margin pixels).
    public 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;
   
        // Get width of column header
        TableCellRenderer renderer = col.getHeaderRenderer();
        if (renderer == null) {
            renderer = table.getTableHeader().getDefaultRenderer();
        }
        Component comp = renderer.getTableCellRendererComponent(
            table, col.getHeaderValue(), false, false, 0, 0);
        width = comp.getPreferredSize().width;
   
        // Get maximum width of column data
        for (int r=0; r<table.getRowCount(); r++) {
            renderer = table.getCellRenderer(r, vColIndex);
            comp = renderer.getTableCellRendererComponent(
                table, table.getValueAt(r, vColIndex), false, false, r, vColIndex);
            width = Math.max(width, comp.getPreferredSize().width);
        }
   
        // Add margin
        width += 2*margin;
   
        // Set the width
        col.setPreferredWidth(width);
    }
View Full Code Here

TOP

Related Classes of javax.swing.table.TableColumn

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.