当前位置: 首页>>代码示例>>Java>>正文


Java DefaultTableColumnModel.addColumn方法代码示例

本文整理汇总了Java中javax.swing.table.DefaultTableColumnModel.addColumn方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultTableColumnModel.addColumn方法的具体用法?Java DefaultTableColumnModel.addColumn怎么用?Java DefaultTableColumnModel.addColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.table.DefaultTableColumnModel的用法示例。


在下文中一共展示了DefaultTableColumnModel.addColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ModelTable

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
public ModelTable() {
	tcm = new DefaultTableColumnModel();
	tcm.addColumn(newCol("No", 50));
	tcm.addColumn(newCol("Name", 200));
	tcm.addColumn(newCol("Field Name", 200));
	tcm.addColumn(newCol("Data Type", 100));
	tcm.addColumn(newCol("comment", 100));

	DefaultTableModel dtm = new DefaultTableModel();
	this.setModel(dtm);
	this.createDefaultColumnsFromModel();
	this.setPreferredScrollableViewportSize(new Dimension(550, 30));
	// setLayout(null);
	setColumnModel(tcm);
	initializeLocalVars();
	updateUI();
}
 
开发者ID:yjgoo,项目名称:pdm-viewer,代码行数:18,代码来源:ModelTable.java

示例2: getDefaultTableColumnModel

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
private final DefaultTableColumnModel getDefaultTableColumnModel() {

        final DefaultTableColumnModel dtcm = new DefaultTableColumnModel();
        final int[] sizeColumn = new int[]{36, 36, 106, 58, 42, 32, 43, 28};
        final int size = sizeColumn.length;

        TableColumn col = null;
        for (int i = 0; i < size; i++) {

            col = new TableColumn(i, sizeColumn[i]);
            col.setHeaderValue(COLUMNS.get(i));
            dtcm.addColumn(col);
        }

        return dtcm;
    }
 
开发者ID:Naoghuman,项目名称:typewriter,代码行数:17,代码来源:HighScore.java

示例3: createColumnModel

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
private static TableColumnModel createColumnModel(TableModel tm) {
	DefaultTableColumnModel columnModel = new DefaultTableColumnModel();
	columnModel.addColumn(createColumn(COL_NR,
			i18n.getText("com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colNr.tile"))); //$NON-NLS-1$
	columnModel.addColumn(createColumn(COL_LAPTIME,
			i18n.getText("com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colLaptime.tile"))); //$NON-NLS-1$
	columnModel.addColumn(createColumn(COL_TOTALTIME,
			i18n.getText("com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colTotaltime.tile"))); //$NON-NLS-1$
	columnModel.addColumn(createColumn(COL_DISTANCE,
			i18n.getText("com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colDistance.tile"))); //$NON-NLS-1$
	columnModel.addColumn(createColumn(COL_TOTALDISTANCE,
			i18n.getText("com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.coltotalDistance.tile"))); //$NON-NLS-1$
	columnModel.addColumn(createColumn(COL_SPEED,
			i18n.getText("com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colSpeed.tile"), //$NON-NLS-1$
			new MinMaxRendererDecorator(new SpeedRenderer())));
	columnModel.addColumn(createColumn(COL_PACE,
			i18n.getText("com.github.pfichtner.jrunalyser.ui.LapInfoPlugin.colPace.tile"), //$NON-NLS-1$
			new MinMaxRendererDecorator(new PaceRenderer())));
	return columnModel;
}
 
开发者ID:pfichtner,项目名称:jrunalyzer,代码行数:21,代码来源:LapInfoPlugin.java

示例4: setupInstance

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
protected void setupInstance(DefaultTableColumnModel instance) {
    super.setupInstance(instance);
    
    for (TableColumnBuilder builder : tableColumns)
        instance.addColumn(builder.createInstance());
    instance.setColumnMargin(columnMargin); 
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:DataViewBuilders.java

示例5: JInventoryLines

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
/** 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);
    m_tableinventory.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 
    m_tableinventory.setIntercellSpacing(new java.awt.Dimension(0, 1));       
    
    m_inventorylines = new InventoryTableModel();
    m_tableinventory.setModel(m_inventorylines);        
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:35,代码来源:JInventoryLines.java

示例6: createColumnModel

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
protected TableColumnModel createColumnModel() {
    DefaultTableColumnModel columnModel = new DefaultTableColumnModel();

    TableCellRenderer cellRenderer = new OscarCellRenderers.RowRenderer(getTableRowColors());

    TableColumn column = new TableColumn();
    column.setModelIndex(OscarTableModel.YEAR_COLUMN);
    column.setHeaderValue(getString("TableDemo.yearColumnTitle", "Year"));
    column.setPreferredWidth(26);
    column.setCellRenderer(new OscarCellRenderers.YearRenderer(getTableRowColors()));
    columnModel.addColumn(column);

    column = new TableColumn();
    column.setModelIndex(OscarTableModel.CATEGORY_COLUMN);
    column.setHeaderValue(getString("TableDemo.categoryColumnTitle", "Award Category"));
    column.setPreferredWidth(100);
    column.setCellRenderer(cellRenderer);
    columnModel.addColumn(column);

    column = new TableColumn();
    column.setModelIndex(OscarTableModel.MOVIE_COLUMN);
    column.setHeaderValue(getString("TableDemo.movieTitleColumnTitle", "Movie Title"));
    column.setPreferredWidth(180);
    HyperlinkCellRenderer hyperlinkRenderer =
            new OscarCellRenderers.MovieRenderer(new IMDBLinkAction(),
                    true, getTableRowColors());
    hyperlinkRenderer.setRowColors(getTableRowColors());
    column.setCellRenderer(hyperlinkRenderer);
    columnModel.addColumn(column);

    column = new TableColumn();
    column.setModelIndex(OscarTableModel.PERSONS_COLUMN);
    column.setHeaderValue(getString("TableDemo.nomineesColumnTitle", "Nominees"));
    column.setPreferredWidth(120);
    column.setCellRenderer(new OscarCellRenderers.NomineeRenderer(getTableRowColors()));
    columnModel.addColumn(column);

    return columnModel;
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:40,代码来源:TableDemo.java

示例7: handleColumnAdded

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
private void handleColumnAdded(TableColumn sourceColumn) {
	TableColumn targetColumn = new TableColumn();
	copyProperties(sourceColumn, targetColumn);
	BeanPropertySync<TableColumn> beanPropertySync = new BeanPropertySync<TableColumn>(
			targetColumn);
	beanPropertySync.setSynchronization(sourceColumn);
	propertySyncMap.put(targetColumn, new TableColumnSync(sourceColumn,
			beanPropertySync));
	DefaultTableColumnModel targetModel = SynchronizedTableColumnModel.this;
	targetModel.addColumn(targetColumn);
	sourceToTargetMap.put(sourceColumn, targetColumn);
}
 
开发者ID:link-intersystems,项目名称:GitDirStat,代码行数:13,代码来源:SynchronizedTableColumnModel.java

示例8: GridTableModel

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
public GridTableModel(List<ColumnConfig> columns, GridDataLoader loader) {
    this.loader = loader;
    this.columnConfigs = columns;
    DefaultTableColumnModel cm = new DefaultTableColumnModel();
    for (int i = 0; i < columns.size(); i++) {
        ColumnConfig cc = columns.get(i);
        TableColumn tc = new TableColumn(i);
        tc.setHeaderValue(cc.getHeader());
        if (null != cc.getMaxWidth()) {
            tc.setMaxWidth(cc.getMaxWidth());
        }
        if (null != cc.getMinWidth()) {
            tc.setMinWidth(cc.getMinWidth());
        }
        if (null != cc.getPreferredWidth()) {
            tc.setPreferredWidth(cc.getPreferredWidth());
        }
        if (null != cc.getWidth()) {
            tc.setWidth(cc.getWidth());
        }
        if (null != cc.getResizable()) {
            tc.setResizable(cc.getResizable());
        }
        cm.addColumn(tc);
    }
    setColumnModel(cm);
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:28,代码来源:GridTableModel.java

示例9: FFTSampleFilterTable

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
public FFTSampleFilterTable(FFTSampleFilterTableModel model) {
	super(model, (TableColumnModel) null);

	DefaultTableColumnModel columnModel = new DefaultTableColumnModel();
	columnModel.setColumnSelectionAllowed(false);

	TableColumn tc;

	tc = new TableColumn(FFTSampleFilterTableModel.FREQUENCY_COLUMN, 200);
	tc.setHeaderValue(model.getColumnName(tc.getModelIndex()));
	columnModel.addColumn(tc);

	tc = new TableColumn(FFTSampleFilterTableModel.COEFFICIENT_COLUMN, 100);
	tc.setHeaderValue(model.getColumnName(tc.getModelIndex()));
	columnModel.addColumn(tc);

	setColumnModel(columnModel);

	setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

	addMouseListener(new MouseAdapter() {

		@Override
		public void mousePressed(MouseEvent e) {
			if (SwingUtilities.isRightMouseButton(e) && (e.getClickCount() == 1)) {
				int index = rowAtPoint(e.getPoint());
				ListSelectionModel selectionModel = getSelectionModel();
				if (!selectionModel.isSelectedIndex(index)) {
					selectionModel.setSelectionInterval(index, index);
				}
			}
		}

	});

	getTableHeader().setReorderingAllowed(false);

}
 
开发者ID:BrainTech,项目名称:svarog,代码行数:39,代码来源:FFTSampleFilterTable.java

示例10: clusteringResultsTable

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
/**
 * Creates the OPTICS clustering results table
 * @return Table
 */
private JComponent clusteringResultsTable() {
    resultVectorTable = new JTable();
    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());
    else
      resultVectorTableModel = new ResultVectorTableModel(null);
    resultVectorTable = new JTable(resultVectorTableModel, resultVectorTableColumnModel);
    resultVectorTable.getColumnModel().getColumn(0).setPreferredWidth(70);
    resultVectorTable.getColumnModel().getColumn(1).setPreferredWidth(400);
    resultVectorTable.getColumnModel().getColumn(2).setPreferredWidth(150);
    resultVectorTable.getColumnModel().getColumn(3).setPreferredWidth(150);
    resultVectorTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    JScrollPane resultVectorTableScrollPane = new JScrollPane(resultVectorTable,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    return resultVectorTableScrollPane;
}
 
开发者ID:williamClanton,项目名称:jbossBA,代码行数:37,代码来源:OPTICS_Visualizer.java

示例11: JInventoryLines

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
/**
 * 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, 50, new DataCellRenderer(javax.swing.SwingConstants.RIGHT), new DefaultCellEditor(new JTextField()));
    c.setHeaderValue(AppLocal.getIntString("label.stockqty"));
    columns.addColumn(c);
    c = new TableColumn(2, 100, new DataCellRenderer(javax.swing.SwingConstants.RIGHT), new DefaultCellEditor(new JTextField()));
    c.setHeaderValue(AppLocal.getIntString("label.price"));
    columns.addColumn(c);
    c = new TableColumn(3, 50, new DataCellRenderer(javax.swing.SwingConstants.RIGHT), new DefaultCellEditor(new JTextField()));
    c.setHeaderValue(AppLocal.getIntString("label.units"));
    columns.addColumn(c);
    c = new TableColumn(4, 100, new DataCellRenderer(javax.swing.SwingConstants.RIGHT), new DefaultCellEditor(new JTextField()));
    c.setHeaderValue(AppLocal.getIntString("label.value"));
    columns.addColumn(c);

    m_tableinventory.setColumnModel(columns);

    m_tableinventory.getTableHeader().setReorderingAllowed(false);
    m_tableinventory.setRowHeight(46);
    m_tableinventory.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m_tableinventory.setIntercellSpacing(new java.awt.Dimension(0, 1));

    m_inventorylines = new InventoryTableModel();
    m_tableinventory.setModel(m_inventorylines);
}
 
开发者ID:nordpos,项目名称:nordpos,代码行数:37,代码来源:JInventoryLines.java

示例12: initComponents

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
private void initComponents(Consumer<Runnable> sortRunner) {
	content = new JPanel();

	DefaultTableColumnModel quickTableColumnModel = new DefaultTableColumnModel();
	SurveyTable.Columns columns = new SurveyTable.Columns();
	quickTableColumnModel.addColumn(columns.fromStation);
	quickTableColumnModel.addColumn(columns.toStation);

	table = new AnnotatingJTable(new SurveyTableModel(),
			quickTableColumnModel);
	ListTableColumn.updateModelIndices(table);

	tableSetup = new DefaultAnnotatingJTableSetup(table, sortRunner);
	((AnnotatingTableRowSorter<SurveyTableModel>) table.getAnnotatingRowSorter())
			.setModelCopier(new SurveyTableModelCopier());

	searchField = new TextComponentWithHintAndClear("Enter search terms");
	highlightButton = new JRadioButton("Highlight");
	filterButton = new JRadioButton("Filter");

	ButtonGroup searchGroup = new ButtonGroup();
	searchGroup.add(highlightButton);
	searchGroup.add(filterButton);

	highlightButton.setSelected(true);

	statsPanel = new StatsPanel();
	statsPanel.setBorder(new EmptyBorder(5, 5, 5, 0));
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:30,代码来源:MiniSurveyDrawer.java

示例13: createControl

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
public JComponent createControl() {

        JPanel actionPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
        //actionPanel.add(new JButton("Start all"));
        //actionPanel.add(new JButton("Stop all"));

        DefaultTableColumnModel columnModel = new DefaultTableColumnModel();
        columnModel.addColumn(new TableColumn(0, 128));
        columnModel.addColumn(new TableColumn(1, 128, new StatusCellRenderer(), null));
        columnModel.getColumn(0).setHeaderValue("Product");
        columnModel.getColumn(1).setHeaderValue("Order Status");

        table = new JTable(productListModel, columnModel);
        table.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    openSelectedProduct();
                }
            }
        });

        table.setRowHeight(table.getRowHeight() + 6);
        table.setGridColor(Color.GRAY);

        JPanel control = new JPanel(new BorderLayout(4, 4));
        control.setBorder(new EmptyBorder(4, 4, 4, 4));
        control.add(new JLabel("Data products ordered:"), BorderLayout.NORTH);
        control.add(new JScrollPane(table), BorderLayout.CENTER);
        control.add(actionPanel, BorderLayout.SOUTH);

        setProductOrderBasket(CBIRSession.getInstance().getProductOrderBasket());

        return control;
    }
 
开发者ID:bcdev,项目名称:esa-pfa,代码行数:36,代码来源:CBIROrderingToolView.java

示例14: setClusterSets

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
public void setClusterSets(int[] csIDs) {
    if (cl != null) {
        if (!cl.isDone()) {
            cl.cancel(true);
        }
    }

    if (csIDs == null) {
        table.setModel(new DefaultTableModel());
        return;
    }

    if (csIDs.length == 0) {
        table.setModel(new DefaultTableModel());
        return;
    }

    ClusterSet cs = ClusterSetCache.getInstance(ds[0], csIDs[0]);

    tm = new ObjectTableModel<>(new ClusterSet[]{cs});
    table.setModel(tm);

    DefaultTableColumnModel cm = new DefaultTableColumnModel();

    for (int k = 0; k < tm.getColumnCount(); k++) {
        TableColumn col = new TableColumn(k, 70);
        col.setHeaderValue(tm.getColumnName(k));
        cm.addColumn(col);
    }

    table.setColumnModel(cm);

    cm.getColumn(0).setPreferredWidth(50);
    cm.getColumn(1).setPreferredWidth(300);

    TableRowSorter<ObjectTableModel<ClusterSet>> trs = new TableRowSorter<ObjectTableModel<ClusterSet>>(tm) {
        @Override
        public void rowsInserted(int firstRow, int endRow) {
            allRowsChanged();
        }
    };

    table.setRowSorter(trs);
    TableCellEditorEx editor = new TableCellEditorEx();

    for (int p = 0; p < table.getColumnCount(); p++) {
        table.getColumnModel().getColumn(p).setCellEditor(editor);
        trs.setComparator(p, new CustomTableRowComparator());
        table.getColumnModel().getColumn(p).setHeaderRenderer(new GlassTableHeader(table.getTableHeader()));
    }

    table.getSelectionModel().addListSelectionListener(lsl);
    table.setColumnSelectionAllowed(false);
    table.setShowVerticalLines(false);

    table.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON3) {
                // frmMain.getInstance().getProfilePopup().show(table, e.getX(), e.getY());
            }
        }
    });
    table.setTransferHandler(new TableTransferHandler());

    if (csIDs.length > 1) {
        cl = new ClusterSetsLazyLoader(Arrays.copyOfRange(csIDs, 1, csIDs.length));
        cl.execute();
    }
}
 
开发者ID:nolanlab,项目名称:vortex,代码行数:71,代码来源:ClusteringResultList.java

示例15: createDefaultsTable

import javax.swing.table.DefaultTableColumnModel; //导入方法依赖的package包/类
protected JTable createDefaultsTable() {
    JTable table = new JTable(new UIDefaultsTableModel());
    table.setRowHeight(rowHeight);
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    table.setIntercellSpacing(new Dimension(0,0));
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    initFilters(table);
    
    DefaultTableColumnModel columnModel = new DefaultTableColumnModel();
    
    Color rowColors[] = new Color[2];
    rowColors[0] = UIManager.getColor("Table.background");
    rowColors[1] = new Color((int)(rowColors[0].getRed() * .90),
                             (int)(rowColors[0].getGreen() * .95), 
                             (int)(rowColors[0].getBlue() * .95));
    
    int width = 0;
    
    TableColumn column = new TableColumn();
    column.setCellRenderer(new KeyRenderer(rowColors));
    column.setModelIndex(UIDefaultsTableModel.KEY_COLUMN);
    column.setHeaderValue("Key");
    column.setPreferredWidth(250);
    columnModel.addColumn(column);
    width += column.getPreferredWidth();
    
    column = new TableColumn();
    column.setCellRenderer(new RowRenderer(rowColors));
    column.setModelIndex(UIDefaultsTableModel.TYPE_COLUMN);
    column.setHeaderValue("Type");
    column.setPreferredWidth(250);
    columnModel.addColumn(column);
    width += column.getPreferredWidth();
    
    column = new TableColumn();
    column.setCellRenderer(new ValueRenderer(rowColors));
    column.setModelIndex(UIDefaultsTableModel.VALUE_COLUMN);
    column.setHeaderValue("Value");
    column.setPreferredWidth(300);
    columnModel.addColumn(column);
    width += column.getPreferredWidth();
    
    table.setColumnModel(columnModel);
    
    table.setPreferredScrollableViewportSize(new Dimension(width, 12 * rowHeight));
    
    return table;
    
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:51,代码来源:DefaultsDisplay.java


注:本文中的javax.swing.table.DefaultTableColumnModel.addColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。