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


Java TableColumnExt.setPreferredWidth方法代码示例

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


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

示例1: testVisibleRowCountUpdateSize

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Issue #508-swingx: cleanup scrollable support.
 * 
 */
@Test
public void testVisibleRowCountUpdateSize() {
    JXTable table = new JXTable(10, 6);
    Dimension dim = table.getPreferredScrollableViewportSize();
    table.setVisibleRowCount(table.getVisibleRowCount() * 2);
    // change the pref width of a column, the pref scrollable width must not
    // be changed. This is testing the table internal reset code.
    TableColumnExt columnExt = table.getColumnExt(0);
    columnExt.setPreferredWidth(columnExt.getPreferredWidth() * 2);
    assertEquals(dim.height * 2, table.getPreferredScrollableViewportSize().height);
    assertEquals(dim.width, table.getPreferredScrollableViewportSize().width);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:17,代码来源:JXTableUnitTest.java

示例2: 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

示例3: 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

示例4: 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

示例5: 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.setPreferredWidth(100);
        addColumn(tableColumn);
    }
}
 
开发者ID:objektwerks,项目名称:swing,代码行数:9,代码来源:RebalanceStatisticsTable.java

示例6: 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.setCellRenderer(statisticsTableCellRenderer);
        tableColumn.setHeaderValue(TextToHtmlSplitter.instance.split(columns[i]));
        if (i == 0) {
            tableColumn.setPreferredWidth(165);
        }
        tableColumn.setSortable(false);
        addColumn(tableColumn);
    }
    getSelectionModel().addListSelectionListener(statisticsListSelectionListener);
}
 
开发者ID:objektwerks,项目名称:swing,代码行数:14,代码来源:BenchmarkPortfolioStatisticsTable.java

示例7: configureColumn

import org.jdesktop.swingx.table.TableColumnExt; //导入方法依赖的package包/类
/**
 * Restores column properties if the model index is the same as the
 * column's model index. Does nothing otherwise. <p>
 * 
 * Here the properties are: width, preferredWidth, visible. 
 * 
 * @param columnExt the column to configure
 */
public void configureColumn(TableColumnExt columnExt) {
    if (modelIndex != columnExt.getModelIndex()) return;
    columnExt.setPreferredWidth(preferredWidth);
    columnExt.setWidth(width);
    columnExt.setVisible(visible);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:XProperties.java


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