Package javax.swing.table

Examples of javax.swing.table.TableColumnModel.removeColumn()


                public void actionPerformed(ActionEvent event) {
                                    for(int i=0; i<14; i++) {
                                      boolean visibility = Boolean.parseBoolean(col_set_table.getModel().getValueAt(i, 0).toString());
                                      String column_name = col_set_table.getModel().getValueAt(i, 1).toString();
                                      //cols.get(column_name).setVisible(visibility);
                                      if(visibility == false) column_model.removeColumn(cols.get(column_name));
                                      System.out.println("Column from set " + cols.get(column_name).getHeaderValue());
                                      System.out.println("<--->" + column_name + "<---->" + visibility);
                                    }
                }
              });
View Full Code Here


  private static void removeFirstColumn(final JTable table) {
    execute(new GuiTask() {
      @Override
      protected void executeInEDT() {
        TableColumnModel columnModel = table.getColumnModel();
        columnModel.removeColumn(columnModel.getColumn(0));
      }
    });
  }

  private static class MyWindow extends TestWindow {
View Full Code Here

            TableColumn column = columnModel.getColumn(i);

            if (
              !preferenceModel.isColumnVisible(
                  column.getHeaderValue().toString())) {
              columnModel.removeColumn(column);
            }
          }

          Set columnSet = new HashSet();
          Enumeration enumeration = columnModel.getColumns();
View Full Code Here

    {
      // Remove any current columns
      final TableColumnModel cm = getColumnModel();
      while (cm.getColumnCount() > 0)
      {
        cm.removeColumn(cm.getColumn(0));
      }

      // Create new columns from the data model info
      for (int i = 0; i < m.getColumnCount(); i++)
      {
View Full Code Here

            int viewPos = table.convertColumnIndexToView(col.modelIndex);
            if (shouldBeVisible && viewPos == -1) {
                addColumnToModel(columnModel, col.modelIndex);
            } else if (shouldBeVisible == false && viewPos != -1) {
                columnModel.removeColumn(columnModel.getColumn(viewPos));
            }
        }
    }

    public void saveColumnVisibility(Preferences prefs, TableColumnModel orig,
View Full Code Here

            int viewPos = getColumnIndex(columnModel, id);
            if (COLUMN_ADDED.equals(pref) && viewPos == -1) {
                addColumnToModel(columnModel, column.getModelIndex());
            } else if (COLUMN_REMOVED.equals(pref) && viewPos != -1) {
                columnModel.removeColumn(columnModel.getColumn(viewPos));
            }
        }
    }

    private void addColumnToModel(TableColumnModel columnModel, int modelIndex) {
View Full Code Here

        tcTableColumnModel.getColumn(STATUS).setMaxWidth(40);
        tcTableColumnModel.getColumn(DETAILS).setPreferredWidth(tcDetailsWidth);
        tcTableColumnModel.getColumn(EXEC_TIME).setPreferredWidth(80);
        tcTableColumnModel.getColumn(EXEC_TIME).setMinWidth(80);
        tcTableColumnModel.getColumn(EXEC_TIME).setMaxWidth(80);
        tcTableColumnModel.removeColumn(tcTableColumnModel.getColumn(TC));
        if (!interactive) {
            tcTable.getSelectionModel().addListSelectionListener(new TCResultsSelectionListeners());
        }
        tcTable.setName("tcTable");
        tcTableColumnModel.addColumnModelListener(new TableColumnModelListener() {
View Full Code Here

      TableColumnModel model = table.getColumnModel();

      if (newColumns.size() > 0) {
        //remove columns from model - will be re-added in the correct order
        for (int i = model.getColumnCount() - 1; i > -1; i--) {
          model.removeColumn(model.getColumn(i));
        }

        for (Iterator iter = newColumns.iterator(); iter.hasNext();) {
          model.addColumn((TableColumn) iter.next());
        }
View Full Code Here

    TableModel m = getModel();
    if (m != null) {
      // Remove any current columns
      TableColumnModel cm = getColumnModel();
      while (cm.getColumnCount() > 0) {
        cm.removeColumn(cm.getColumn(0));
      }

      // Create one column only
      TableColumn newColumn = new TableColumn(0);
      addColumn(newColumn);
View Full Code Here

    public void hideColumn(int columnIndex) {
        TableColumnModel columnModel = getColumnModel();
        int viewColumnIndex = convertColumnIndexToView(columnIndex);
        TableColumn column = columnModel.getColumn(viewColumnIndex);
        columnModel.removeColumn(column);

        ColumnInfo columnInfo = getModel().getColumnInfo(columnIndex);
        datasetEditor.getState().getColumnSetup().getColumnState(columnInfo.getName()).setVisible(false);
    }
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.