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


Java TableColumnExt.setMaxWidth方法代码示例

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


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

示例1: interactiveTestColumnResizable

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/** 
 *  TableColumnExt: user friendly resizable  
 * 
 */
public void interactiveTestColumnResizable() {
    final JXTable table = new JXTable(sortableTableModel);
    table.setColumnControlVisible(true);
    final TableColumnExt priorityColumn = table.getColumnExt("First Name");
    JXFrame frame = wrapWithScrollingInFrame(table, "JXTable: Column with Min=Max not resizable");
    Action action = new AbstractAction("Toggle MinMax of FirstName") {

        @Override
        public void actionPerformed(ActionEvent e) {
            // user-friendly resizable flag
            if (priorityColumn.getMinWidth() == priorityColumn.getMaxWidth()) {
                priorityColumn.setMinWidth(50);
                priorityColumn.setMaxWidth(150);
            } else {
                priorityColumn.setMinWidth(100);
                priorityColumn.setMaxWidth(100);
            }
        }
        
    };
    addAction(frame, action);
    frame.setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:28,代码来源:JXTableVisualCheck.java

示例2: configureTableColumn

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
@Override
public void configureTableColumn(final TableModel model, final TableColumnExt columnExt)
{
	super.configureTableColumn(model, columnExt);

	final TableColumnModel columnModel = getTableColumnModelOrNull(model, columnExt);
	if (columnModel == null)
	{
		return;
	}

	final int width = columnModel.getWidth();
	if (width > 0)
	{
		columnExt.setWidth(width);
		columnExt.setMaxWidth(width);
	}

	if (columnModel instanceof ImpDataLineRowTableColumnModel)
	{
		columnExt.setCellRenderer(new ImpDataCellRenderer());
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:24,代码来源:FileImportPreviewColumnFactory.java

示例3: interactiveTestExpandsToViewportWidth

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Issue #??-swingx: column auto-sizing support.
 *
 */
public void interactiveTestExpandsToViewportWidth() {
    final JXTable table = new JXTable();
    ColumnFactory factory = new ColumnFactory() {
        @Override
        public void configureTableColumn(TableModel model, TableColumnExt columnExt) {
             super.configureTableColumn(model, columnExt);
             if (model.getColumnClass(columnExt.getModelIndex()) == Integer.class) {
                 // to see the effect: excess width is distributed relative
                 // to the difference between maxSize and prefSize
                 columnExt.setMaxWidth(200);
             } else {
             
                 columnExt.setMaxWidth(1024);
             }
        }
        
    };
    table.setColumnFactory(factory);
    table.setColumnControlVisible(true);
    table.setModel(sortableTableModel);
    table.setHorizontalScrollEnabled(true);
    table.packAll();
    JXFrame frame = wrapWithScrollingInFrame(table, "expand to width");
    Action toggleModel = new AbstractAction("toggle model") {

        @Override
        public void actionPerformed(ActionEvent e) {
            table.setModel(table.getModel() == sortableTableModel ? 
                    new DefaultTableModel(20, 4) : sortableTableModel);
            
        }
        
    };
    addAction(frame, toggleModel);
    frame.setSize(table.getPreferredSize().width - 50, 300);
    frame.setVisible(true);
    LOG.info("table: " + table.getWidth());
    LOG.info("Viewport: " + table.getParent().getWidth());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:44,代码来源:JXTableVisualCheck.java

示例4: resetView

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
@Override
public void resetView() {
    KnownVillageManager.getSingleton().addManagerListener(this);
    MarkerManager.getSingleton().addManagerListener(this);
    jWatchtowerTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderRenderer());
    String[] cols = new String[]{"Stufe", "Farbe"};
    for (String col : cols) {
        TableColumnExt columns = jWatchtowerTable.getColumnExt(col);
        columns.setPreferredWidth(80);
        columns.setMaxWidth(80);
        columns.setWidth(80);
    }

    ((WatchtowerTableModel) jWatchtowerTable.getModel()).fireTableDataChanged();
}
 
开发者ID:Torridity,项目名称:dsworkbench,代码行数:16,代码来源:DSWorkbenchWatchtowerFrame.java

示例5: resetView

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
public void resetView(boolean pClear) {
    if (pClear) {
        DistanceManager.getSingleton().clear();
    }
    jDistanceTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    int w0 = 200;
    for (int i = 0; i < jDistanceTable.getColumnCount(); i++) {
        TableColumnExt column = jDistanceTable.getColumnExt(i);
        if (i == 0) {
            column.setWidth(w0);
            column.setPreferredWidth(w0);
            column.setMaxWidth(w0);
            column.setMinWidth(w0);
            column.setResizable(false);
        } else {
            String v = (String) column.getHeaderValue();
            int w = getGraphics().getFontMetrics().stringWidth(v);
            column.setWidth(w);
            column.setPreferredWidth(w);
        }
    }

    jDistanceTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderRenderer());
    if (pClear) {
        ((DistanceTableModel) jDistanceTable.getModel()).fireTableStructureChanged();
    } else {
        ((DistanceTableModel) jDistanceTable.getModel()).fireTableDataChanged();
    }
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    model.addElement(UnknownUnit.getSingleton());
    for (UnitHolder unit : DataHolder.getSingleton().getUnits()) {
        model.addElement(unit);
    }
    unitBox.setModel(model);
}
 
开发者ID:Torridity,项目名称:dsworkbench,代码行数:37,代码来源:DSWorkbenchDistanceFrame.java

示例6: initTableColums

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
public static void initTableColums(JXTable table, int width, String... headers) {
    for (String caption : headers) {
        TableColumnExt columns = table.getColumnExt(caption);
        columns.setPreferredWidth(width);
        columns.setMaxWidth(width);
        columns.setWidth(width);
    }
}
 
开发者ID:Torridity,项目名称:dsworkbench,代码行数:9,代码来源:UIHelper.java

示例7: configureTableColumn

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
@Override
public void configureTableColumn(final TableModel model, final TableColumnExt columnExt)
{
	super.configureTableColumn(model, columnExt);

	final TableModelMetaInfo<?> modelMetaInfo = getTableModelMetaInfoOrNull(model);
	if (modelMetaInfo == null)
	{
		return;
	}

	final int columnIndex = columnExt.getModelIndex();
	final TableColumnInfo columnMetaInfo = modelMetaInfo.getTableColumnInfo(columnIndex);

	columnExt.setCellRenderer(createTableCellRenderer(columnMetaInfo));
	columnExt.setCellEditor(createTableCellEditor(columnMetaInfo));

	if (columnMetaInfo.isSelectionColumn())
	{
		columnExt.setMaxWidth(25);
		columnExt.putClientProperty(AnnotatedColumnControlButton.PROPERTY_DisableColumnControl, true);
	}

	updateColumnExtFromMetaInfo(columnExt, columnMetaInfo);

	//
	// Synchronize: columnMetaInfo -> columnExt
	columnMetaInfo.addPropertyChangeListener(new TableColumnInfo2TableColumnExtSynchronizer(columnExt));
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:30,代码来源:AnnotatedTableColumnFactory.java

示例8: TickerCompanyTableColumnModel

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
public TickerCompanyTableColumnModel(String... columns) {
    for (int i = 0; i < columns.length; i++) {
        TableColumnExt tableColumn = new TableColumnExt(i);
        tableColumn.setHeaderValue(TextToHtmlSplitter.instance.split(columns[i]));
        if (i == 0) {
            tableColumn.setMaxWidth(75);
        }
        addColumn(tableColumn);
    }
}
 
开发者ID:objektwerks,项目名称:swing,代码行数:11,代码来源:TickerCompanyTable.java

示例9: StatisticsTableColumnModel

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
public StatisticsTableColumnModel(String... columns) {
    for (int i = 0; i < columns.length; i++) {
        TableColumnExt tableColumn = new TableColumnExt(i);
        tableColumn.setHeaderValue(TextToHtmlSplitter.instance.split(columns[i]));
        if (i == 0) {
            tableColumn.setMaxWidth(75);
        }
        addColumn(tableColumn);
    }
}
 
开发者ID:objektwerks,项目名称:swing,代码行数:11,代码来源:RegimeStatisticsTable.java


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