Package javax.swing.table

Examples of javax.swing.table.TableColumn


                public TableCellRenderer getCellRenderer(int row, int column) {
                      return new VariabilityCellRenderer ();
                }               
            };
            table.setBackground(bgColor);
            TableColumn vpColumn = table.getColumnModel().getColumn(2);
            vpColumn.setCellEditor(new VariabilityCellEditor());
            JScrollPane scroll = new JScrollPane (table);
            scroll.setBackground(bgColor);
            cPanel.add(scroll);
      if (cPanel != null)
        classPanels.put(element.getAttribute("id"), cPanel);
View Full Code Here


    private void createAvailableColumns(Home home, UserPreferences preferences) {
      this.availableColumns = new HashMap<HomePieceOfFurniture.SortableProperty, TableColumn>();
      TableCellRenderer headerRenderer = getHeaderRenderer(home);
      // Create the list of custom columns
      for (HomePieceOfFurniture.SortableProperty columnProperty : HomePieceOfFurniture.SortableProperty.values()) {
        TableColumn tableColumn = new TableColumn();
        tableColumn.setIdentifier(columnProperty);
        tableColumn.setHeaderValue(getColumnName(columnProperty, preferences));
        tableColumn.setCellRenderer(getColumnRenderer(columnProperty, preferences));
        tableColumn.setPreferredWidth(getColumnPreferredWidth(columnProperty));
        tableColumn.setHeaderRenderer(headerRenderer);
        this.availableColumns.put(columnProperty, tableColumn);
      }
    }
View Full Code Here

     * Updates displayed columns list from furniture visible properties.
     */
    private void updateModelColumns(List<HomePieceOfFurniture.SortableProperty> furnitureVisibleProperties) {
      // Remove columns not in furnitureVisibleProperties
      for (int i = this.tableColumns.size() - 1; i >= 0; i--) {
        TableColumn tableColumn = this.tableColumns.get(i);
        Object columnIdentifier = tableColumn.getIdentifier();
        if ((columnIdentifier instanceof HomePieceOfFurniture.SortableProperty)
            && !furnitureVisibleProperties.contains(columnIdentifier)) {
          removeColumn(tableColumn);
        }
      }
      // Add columns not currently displayed
      for (HomePieceOfFurniture.SortableProperty visibleProperty : furnitureVisibleProperties) {
        TableColumn tableColumn = this.availableColumns.get(visibleProperty);
        if (!this.tableColumns.contains(tableColumn)) {
          addColumn(tableColumn);
        }
      }
      // Reorder columns
      for (int i = 0, n = furnitureVisibleProperties.size(); i < n; i++) {
        TableColumn tableColumn = this.availableColumns.get(furnitureVisibleProperties.get(i));
        int tableColumnIndex = this.tableColumns.indexOf(tableColumn);
        if (tableColumnIndex != i) {
          moveColumn(tableColumnIndex, i);
        }
      }
View Full Code Here

    TableColumnModel mainTableColModel = mainTable.getColumnModel();
    mainTableColModel.getColumn(AbstractPdfSelectionTableModel.PASSWORD).setCellEditor(
        new DefaultCellEditor(new JPasswordField()));

    TableColumn tc = mainTableColModel.getColumn(AbstractPdfSelectionTableModel.ROW_NUM);
    tc.setPreferredWidth(25);
    tc.setMaxWidth(35);

    // header tooltip
    JPdfSelectionToolTipHeader toolTipHeader = new JPdfSelectionToolTipHeader(mainTableColModel);
    toolTipHeader.setReorderingAllowed(false);
    toolTipHeader.setToolTips(tableModel.getToolTips());
View Full Code Here

        Main.m_settings.m_colWidth = new int[anzahl];
        TableColumnModel colModel = m_table.getColumnModel();
        for (i=0; i<anzahl; i++)
        {
            Main.m_settings.m_cols[i] = (short)m_table.convertColumnIndexToModel(i);
            TableColumn tableCol = colModel.getColumn(i);
            Main.m_settings.m_colWidth[i] = tableCol.getPreferredWidth();
        }

        // Custum tree entries
        DefaultTreeModel treeModel = (DefaultTreeModel)m_tree.getModel();
        JPathTreeNode root = (JPathTreeNode)treeModel.getRoot();
View Full Code Here

    {
        assert m_table.getColumnCount() == 0;
        int i;
        for (i=0; i<Main.m_settings.m_cols.length; i++)
        {
            TableColumn tblCol = new TableColumn();
            tblCol.setModelIndex(Main.m_settings.m_cols[i]);
            if (JExifDataModel.m_colTag[Main.m_settings.m_cols[i]] == JExifTag.GPSTAG_TAG_MAPLINK)
            {
                int w = new ImageIcon(Main.m_url_map).getIconWidth();
                tblCol.setPreferredWidth(w);
                tblCol.setMaxWidth(w);
                tblCol.setMinWidth(w);
            }
            else
                tblCol.setPreferredWidth(Main.m_settings.m_colWidth[i]);
            m_table.addColumn(tblCol);
        }
    }
View Full Code Here

        int i, anzahl = m_table.getColumnCount();
        TableColumnModel colModel = m_table.getColumnModel();

        for (i=0; i<anzahl; i++)
        {
            TableColumn tableCol = colModel.getColumn(i);
            int colIndex = m_table.convertColumnIndexToModel(i);
            JLabel label = (JLabel)tableCol.getHeaderRenderer();
            if (label != null)
            {
                label.setIcon(m_tableData.getColIcon(colIndex));
            }
            else
            {
                // the new way
                String str = m_tableData.getColIconStr(colIndex);
//                if (str == null || str.isEmpty)
                if (str == null || str.length() == 0)
                    str = m_tableData.getColumnName(colIndex);
                else
                    str = String.format("<html><img src=\"%s\">&nbsp;%s</html>", str, m_tableData.getColumnName(colIndex));
                tableCol.setHeaderValue(str);
            }
        }
    }
View Full Code Here

                                JColChooserDialog dia = new JColChooserDialog(Main.m_mainFrame, dataArray);
                                dia.setVisible(true);
                                if (dia.isOk())
                                {
                                    JColChooserData data = dia.getSelectedItem();
                                    TableColumn tblCol = new TableColumn();
                                    tblCol.setModelIndex(data.m_modelColIndex);
                                    TableColumnModel colModel = m_table.getColumnModel();
                                    colIndex = colModel.getColumnIndexAtX(mouseEv.getX());
                                    m_table.addColumn(tblCol);
                                    m_table.moveColumn(m_table.getColumnCount()-1, colIndex);
                                    if (JExifDataModel.m_colTag[data.m_modelColIndex] == JExifTag.GPSTAG_TAG_MAPLINK)
                                    {
                                        int w = new ImageIcon(Main.m_url_map).getIconWidth();
                                        tblCol.setPreferredWidth(w);
                                        tblCol.setMaxWidth(w);
                                        tblCol.setMinWidth(w);
                                    }
                                }
                            }
                        });
                    }
                    if (m_table.getColumnCount() > 1)
                    {
                        menuItem = new JStatusMenuItem(Main.getString("menu_tableheader_delete"), Main.getString("statusbar_menutableheader_delete_help"), m_statusBar);
                        menuItem.addActionListener(new ActionListener()
                        {
                            public void actionPerformed (ActionEvent ev)
                            {
                                TableColumnModel colModel = m_table.getColumnModel();
                                int colIndex = colModel.getColumnIndexAtX(mouseEv.getX());
                                TableColumn tblCol = colModel.getColumn(colIndex);
                                m_table.removeColumn(tblCol);
                                }
                        });
                        menu.add(menuItem);
                    }
View Full Code Here

                return column == 0;
            }
        };
        table.setModel(model);

        TableColumn partCol = table.getColumnModel().getColumn(1);
        partCol.setCellRenderer(new TextRenderer());

        TableColumn percCol = table.getColumnModel().getColumn(2);
        percCol.setCellRenderer(new TextRenderer());
        percCol.setPreferredWidth(60);
        percCol.setMaxWidth(60);

        TableColumn colorCol = table.getColumnModel().getColumn(0);
        colorCol.setCellEditor(new ColorChooserEditor());
        colorCol.setCellRenderer(new ColorChooserRenderer());
        colorCol.setPreferredWidth(16);
        colorCol.setMaxWidth(16);

        for (int j = 0; j < partsArray.length; j++) {
            final Part p = partsArray[partsArray.length - 1 - j];
            model.setValueAt(p.getValue(), j, 0);
            model.setValueAt(p.getDisplayName(), j, 1);
View Full Code Here

                return column == 0;
            }
        };
        table.setModel(model);

        TableColumn partCol = table.getColumnModel().getColumn(1);
        partCol.setCellRenderer(new TextRenderer());

        TableColumn percCol = table.getColumnModel().getColumn(2);
        percCol.setCellRenderer(new TextRenderer());
        percCol.setPreferredWidth(60);
        percCol.setMaxWidth(60);

        TableColumn colorCol = table.getColumnModel().getColumn(0);
        colorCol.setCellEditor(new ColorChooserEditor());
        colorCol.setCellRenderer(new ColorChooserRenderer());
        colorCol.setPreferredWidth(16);
        colorCol.setMaxWidth(16);

        for (int j = 0; j < partsArray.length; j++) {
            final Part p = partsArray[partsArray.length - 1 - j];
            model.setValueAt(p.getValue(), j, 0);
            model.setValueAt(p.getDisplayName(), j, 1);
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.