Examples of TableColumnModel


Examples of javax.swing.table.TableColumnModel

            // sizes by double click. See class ButtonTableHeader.

            // figure out which column the user clicked on
            // so we can pass in the right column description
            Point pt = evt.getPoint();
            TableColumnModel cm = this.getColumnModel();
            int columnIndexAtX = cm.getColumnIndexAtX(pt.x);

            int modelIndex = cm.getColumn(columnIndexAtX).getModelIndex();


            if (RowNumberTableColumn.ROW_NUMBER_MODEL_INDEX != modelIndex)
            {
               ColumnDisplayDefinition colDefs[] = getColumnDefinitions();
View Full Code Here

Examples of javax.swing.table.TableColumnModel

      final String data = "THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG";
      final int _multiplier =
        getFontMetrics(getFont()).stringWidth(data) / data.length();

      TableColumnModel cm = new DefaultTableColumnModel();
      for (int i = 0; i < colDefs.length; ++i)
      {
        ColumnDisplayDefinition colDef = colDefs[i];
        int colWidth = colDef.getDisplayWidth() * _multiplier;
        if (colWidth > IDataSetViewer.MAX_COLUMN_WIDTH * _multiplier)
        {
          colWidth = IDataSetViewer.MAX_COLUMN_WIDTH * _multiplier;
        }

        TableColumn col = new TableColumn(i, colWidth,
          CellComponentFactory.getTableCellRenderer(colDefs[i]), null);
        col.setHeaderValue(colDef.getColumnName());
        cm.addColumn(col);
      }

      setColumnModel(cm);

      _colDefs = colDefs;

      // set up cell editors on first row
      for (int i=0; i< colDefs.length; i++) {
        cm.getColumn(i).setCellEditor(
          CellComponentFactory.getInCellEditor(this, _colDefs[i]));
      }


      // the second row contains a multi-line description,
View Full Code Here

Examples of javax.swing.table.TableColumnModel

          rowContent.format = value.toString();
      }
    };

    table = new JTable(tm);
    TableColumnModel cm = table.getColumnModel();
    cm.getColumn(0).setPreferredWidth(140);
    cm.getColumn(1).setPreferredWidth(400);

    FormLayout layout = new FormLayout("1dlu, 8dlu, left:pref, 4dlu, fill:pref", "");

    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
View Full Code Here

Examples of javax.swing.table.TableColumnModel

            c.stopFetching();
        }
    }

    protected void setWidths() {
        TableColumnModel cm = glTable.getColumnModel();
        cm.getColumn(0).setPreferredWidth(55);
        cm.getColumn(0).setMinWidth(55);
        cm.getColumn(0).setMaxWidth(55);
        for (int i = 1; i < PAD; i++) {
            // Lock the width of icon columns.
            cm.getColumn(i).setPreferredWidth(GUIGlobals.WIDTH_ICON_COL);
            cm.getColumn(i).setMinWidth(GUIGlobals.WIDTH_ICON_COL);
            cm.getColumn(i).setMaxWidth(GUIGlobals.WIDTH_ICON_COL);
        }

        for (int i = 0; i < fields.length; i++) {
            int width = BibtexFields.getFieldLength(fields[i]);
            glTable.getColumnModel().getColumn(i + PAD).setPreferredWidth(width);
View Full Code Here

Examples of javax.swing.table.TableColumnModel

      setShowHorizontalLines(true);
      setColumnSelectionAllowed(true);
      DefaultCellEditor dce = new DefaultCellEditor(new JTextField());
      dce.setClickCountToStart(2);
      setDefaultEditor(String.class, dce);
      TableColumnModel cm = getColumnModel();
      cm.getColumn(0).setPreferredWidth(800);
      cm.getColumn(1).setPreferredWidth(2000);
      sp.getViewport().setBackground(Globals.prefs.getColor("tableBackground"));
      // getInputMap().remove(GUIGlobals.exitDialog);
      getInputMap().put(frame.prefs.getKey("Close dialog"), "close");
      getActionMap().put("close", closeAction);
      getInputMap().put(frame.prefs.getKey("Help"), "help");
View Full Code Here

Examples of javax.swing.table.TableColumnModel

    public void setWidths() {
        // Setting column widths:
        int ncWidth = Globals.prefs.getInt("numberColWidth");
        String[] widths = Globals.prefs.getStringArray("columnWidths");
        TableColumnModel cm = getColumnModel();
        cm.getColumn(0).setPreferredWidth(ncWidth);
        for (int i = 1; i < tableFormat.padleft; i++) {
            // Lock the width of icon columns.
            cm.getColumn(i).setPreferredWidth(GUIGlobals.WIDTH_ICON_COL);
            cm.getColumn(i).setMinWidth(GUIGlobals.WIDTH_ICON_COL);
            cm.getColumn(i).setMaxWidth(GUIGlobals.WIDTH_ICON_COL);
        }
        for (int i = tableFormat.padleft; i < getModel().getColumnCount(); i++) {
            try {
                cm.getColumn(i).setPreferredWidth(Integer.parseInt(widths[i - tableFormat.padleft]));
            } catch (Throwable ex) {
                Globals.logger("Exception while setting column widths. Choosing default.");
                cm.getColumn(i).setPreferredWidth(GUIGlobals.DEFAULT_FIELD_LENGTH);
            }

        }
    }
View Full Code Here

Examples of javax.swing.table.TableColumnModel

    });
   

    ZipFileChooserTableModel tableModel = new ZipFileChooserTableModel( zipFile, getSelectableZipEntries(zipFile) );
    table = new JTable(tableModel);
    TableColumnModel cm = table.getColumnModel();
    cm.getColumn(0).setPreferredWidth(200);
    cm.getColumn(1).setPreferredWidth(150);
    cm.getColumn(2).setPreferredWidth(100);
    JScrollPane sp = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                     JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setPreferredScrollableViewportSize(new Dimension(500, 150));
    if (table.getRowCount() > 0) {
View Full Code Here

Examples of javax.swing.table.TableColumnModel

    /**
     * Set column widths according to which field is shown, and lock icon columns
     * to a suitable width.
     */
    protected void setWidths() {
        TableColumnModel cm = entryTable.getColumnModel();
        for (int i = 0; i < PAD; i++) {
            // Lock the width of icon columns.
            cm.getColumn(i).setPreferredWidth(GUIGlobals.WIDTH_ICON_COL);
            cm.getColumn(i).setMinWidth(GUIGlobals.WIDTH_ICON_COL);
            cm.getColumn(i).setMaxWidth(GUIGlobals.WIDTH_ICON_COL);
        }

        for (int i = 0; i < fields.length; i++) {
            int width = BibtexFields.getFieldLength(fields[i]);
            cm.getColumn(i + PAD).setPreferredWidth(width);
        }
    }
View Full Code Here

Examples of javax.swing.table.TableColumnModel

                }

            };

        colSetup = new JTable(tm);
        TableColumnModel cm = colSetup.getColumnModel();
        cm.getColumn(0).setPreferredWidth(140);
        cm.getColumn(1).setPreferredWidth(80);

        FormLayout layout = new FormLayout
            ("1dlu, 8dlu, left:pref, 4dlu, fill:pref",//, 4dlu, fill:60dlu, 4dlu, fill:pref",
             "");
        DefaultFormBuilder builder = new DefaultFormBuilder(layout);
View Full Code Here

Examples of javax.swing.table.TableColumnModel

          //putValue(SHORT_DESCRIPTION, Globals.lang("Update to current column widths"));
        }
        public void actionPerformed(ActionEvent e) {
            BasePanel panel = frame.basePanel();
            if (panel == null) return;
            TableColumnModel colMod = panel.mainTable.getColumnModel();
            colSetup.setValueAt(""+colMod.getColumn(0).getWidth(), 0, 1);
            for (int i=1; i<colMod.getColumnCount(); i++) {
            try {
                String name = panel.mainTable.getColumnName(i).toLowerCase();
                int width = colMod.getColumn(i).getWidth();
                //Util.pr(":"+((String)colSetup.getValueAt(i-1, 0)).toLowerCase());
                //Util.pr("-"+name);
                if ((i <= tableRows.size()) && (((String)colSetup.getValueAt(i, 0)).toLowerCase()).equals(name))
                    colSetup.setValueAt(""+width, i, 1);
                else { // Doesn't match; search for a matching col in our table
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.