本文整理汇总了Java中org.jdesktop.swingx.table.TableColumnExt.setMinWidth方法的典型用法代码示例。如果您正苦于以下问题:Java TableColumnExt.setMinWidth方法的具体用法?Java TableColumnExt.setMinWidth怎么用?Java TableColumnExt.setMinWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.swingx.table.TableColumnExt
的用法示例。
在下文中一共展示了TableColumnExt.setMinWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: 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);
}