本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}