本文整理了Java中javax.swing.table.TableColumn.getMinWidth()
方法的一些代码示例,展示了TableColumn.getMinWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableColumn.getMinWidth()
方法的具体详情如下:
包路径:javax.swing.table.TableColumn
类名称:TableColumn
方法名:getMinWidth
暂无
代码示例来源:origin: stackoverflow.com
JTable table = new JTable( ... );
table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
for (int column = 0; column < table.getColumnCount(); column++)
{
TableColumn tableColumn = table.getColumnModel().getColumn(column);
int preferredWidth = tableColumn.getMinWidth();
int maxWidth = tableColumn.getMaxWidth();
for (int row = 0; row < table.getRowCount(); row++)
{
TableCellRenderer cellRenderer = table.getCellRenderer(row, column);
Component c = table.prepareRenderer(cellRenderer, row, column);
int width = c.getPreferredSize().width + table.getIntercellSpacing().width;
preferredWidth = Math.max(preferredWidth, width);
// We've exceeded the maximum width, no need to check other rows
if (preferredWidth >= maxWidth)
{
preferredWidth = maxWidth;
break;
}
}
tableColumn.setPreferredWidth( preferredWidth );
}
代码示例来源:origin: com.eas.platypus/platypus-js-grid
public int getMinWidth() {
if (tableColumn != null) {
return tableColumn.getMinWidth();
} else {
return minWidth;
}
}
代码示例来源:origin: xyz.cofe/gui.swing
public int getMinWidth() {
return tableColumn.getMinWidth();
}
代码示例来源:origin: com.synaptix/SynaptixSwing
/**
* Return the minimum size of the header. The minimum width is the sum of
* the minimum widths of each column (plus inter-cell spacing).
*/
public Dimension getMinimumSize(JComponent c) {
long width = 0;
Enumeration enumeration = footer.getTable().getColumnModel()
.getColumns();
while (enumeration.hasMoreElements()) {
TableColumn aColumn = (TableColumn) enumeration.nextElement();
width = width + aColumn.getMinWidth();
}
return createHeaderSize(width);
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
public void mouseDragged(MouseEvent e) {
if (!armed && !dragging) return;
int newPos = e.getPoint().x;
TableColumn c0 = getColumnModel().getColumn(0);
TableColumn c1 = getColumnModel().getColumn(1);
int min = Math.max(c0.getMinWidth(), getWidth() -
c1.getMaxWidth());
int max = Math.min(c0.getMaxWidth(), getWidth() -
c1.getMinWidth());
if ((newPos >= min) && (newPos <= max)) {
pos = newPos;
update();
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
/** Return the minimum size of the header. The minimum width is the sum
* of the minimum widths of each column (plus inter-cell spacing).
*/
public Dimension getMinimumSize(JComponent c)
{
long width=0;
Enumeration enumeration=header.getColumnModel().getColumns();
while(enumeration.hasMoreElements())
{
TableColumn aColumn=(TableColumn)enumeration.nextElement();
width=width+aColumn.getMinWidth();
}
return createHeaderSize(width);
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
public static boolean skipableColumn(TableColumn tc) {
return (tc.getWidth() == 0 && tc.getMinWidth() == 0 && tc.getMaxWidth() == 0);
}
代码示例来源:origin: org.netbeans.api/org-openide-explorer
public void mouseDragged(MouseEvent e) {
if (!armed && !dragging) {
return;
}
int newPos = e.getPoint().x;
TableColumn c0 = getColumnModel().getColumn(0);
TableColumn c1 = getColumnModel().getColumn(1);
int min = Math.max(c0.getMinWidth(), getWidth() - c1.getMaxWidth());
int max = Math.min(c0.getMaxWidth(), getWidth() - c1.getMinWidth());
if ((newPos >= min) && (newPos <= max)) {
pos = newPos;
update();
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
public void mouseDragged(MouseEvent e) {
if (!armed && !dragging) return;
int newPos = e.getPoint().x;
TableColumn c0 = getColumnModel().getColumn(0);
TableColumn c1 = getColumnModel().getColumn(1);
int min = Math.max(c0.getMinWidth(), getWidth() -
c1.getMaxWidth());
int max = Math.min(c0.getMaxWidth(), getWidth() -
c1.getMinWidth());
if ((newPos >= min) && (newPos <= max)) {
pos = newPos;
update();
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Sets the instances who's attribute names will be displayed.
*
* @param newInstances the new set of instances
*/
public void setInstances(Instances newInstances) {
if (m_Model == null) {
m_Model = new AttributeTableModel(newInstances);
m_Table.setModel(m_Model);
TableColumnModel tcm = m_Table.getColumnModel();
tcm.getColumn(0).setMaxWidth(60);
tcm.getColumn(1).setMaxWidth(tcm.getColumn(1).getMinWidth());
tcm.getColumn(2).setMinWidth(100);
} else {
m_Model.setInstances(newInstances);
m_Table.clearSelection();
}
m_IncludeAll.setEnabled(true);
m_RemoveAll.setEnabled(true);
m_Invert.setEnabled(true);
m_Pattern.setEnabled(true);
m_Table.sizeColumnsToFit(2);
m_Table.revalidate();
m_Table.repaint();
}
代码示例来源:origin: net.sf.meka/meka
/**
* Sets the instances who's attribute names will be displayed.
*
* @param newInstances the new set of instances
*/
public void setInstances(Instances newInstances) {
if (m_Model == null) {
m_Model = new AttributeTableModel(newInstances);
m_Table.setModel(m_Model);
TableColumnModel tcm = m_Table.getColumnModel();
tcm.getColumn(0).setMaxWidth(60);
tcm.getColumn(1).setMaxWidth(tcm.getColumn(1).getMinWidth());
tcm.getColumn(2).setMinWidth(100);
} else {
m_Model.setInstances(newInstances);
m_Table.clearSelection();
}
m_IncludeAll.setEnabled(true);
m_RemoveAll.setEnabled(true);
m_Invert.setEnabled(true);
m_Pattern.setEnabled(true);
m_Table.sizeColumnsToFit(2);
m_Table.revalidate();
m_Table.repaint();
}
代码示例来源:origin: Waikato/meka
/**
* Sets the instances who's attribute names will be displayed.
*
* @param newInstances the new set of instances
*/
public void setInstances(Instances newInstances) {
if (m_Model == null) {
m_Model = new AttributeTableModel(newInstances);
m_Table.setModel(m_Model);
TableColumnModel tcm = m_Table.getColumnModel();
tcm.getColumn(0).setMaxWidth(60);
tcm.getColumn(1).setMaxWidth(tcm.getColumn(1).getMinWidth());
tcm.getColumn(2).setMinWidth(100);
} else {
m_Model.setInstances(newInstances);
m_Table.clearSelection();
}
m_IncludeAll.setEnabled(true);
m_RemoveAll.setEnabled(true);
m_Invert.setEnabled(true);
m_Pattern.setEnabled(true);
m_Table.sizeColumnsToFit(2);
m_Table.revalidate();
m_Table.repaint();
}
代码示例来源:origin: stackoverflow.com
JTable table = new JTable( ... );
table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
for (int column = 0; column < table.getColumnCount(); column++)
{
TableColumn tableColumn = table.getColumnModel().getColumn(column);
int preferredWidth = tableColumn.getMinWidth();
int maxWidth = tableColumn.getMaxWidth();
for (int row = 0; row < table.getRowCount(); row++)
{
TableCellRenderer cellRenderer = table.getCellRenderer(row, column);
Component c = table.prepareRenderer(cellRenderer, row, column);
int width = c.getPreferredSize().width + table.getIntercellSpacing().width;
preferredWidth = Math.max(preferredWidth, width);
// We've exceeded the maximum width, no need to check other rows
if (preferredWidth >= maxWidth)
{
preferredWidth = maxWidth;
break;
}
}
tableColumn.setPreferredWidth( preferredWidth );
}
代码示例来源:origin: stackoverflow.com
JTable table = new JTable( ... );
table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
for (int column = 0; column < table.getColumnCount(); column++)
{
TableColumn tableColumn = table.getColumnModel().getColumn(column);
int preferredWidth = tableColumn.getMinWidth();
int maxWidth = tableColumn.getMaxWidth();
for (int row = 0; row < table.getRowCount(); row++)
{
TableCellRenderer cellRenderer = table.getCellRenderer(row, column);
Component c = table.prepareRenderer(cellRenderer, row, column);
int width = c.getPreferredSize().width + table.getIntercellSpacing().width;
preferredWidth = Math.max(preferredWidth, width);
// We've exceeded the maximum width, no need to check other rows
if (preferredWidth >= maxWidth)
{
preferredWidth = maxWidth;
break;
}
}
tableColumn.setPreferredWidth( preferredWidth );
}
代码示例来源:origin: stackoverflow.com
JTable table = new JTable( ... );
table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
for (int column = 0; column < table.getColumnCount(); column++)
{
TableColumn tableColumn = table.getColumnModel().getColumn(column);
int preferredWidth = tableColumn.getMinWidth();
int maxWidth = tableColumn.getMaxWidth();
for (int row = 0; row < table.getRowCount(); row++)
{
TableCellRenderer cellRenderer = table.getCellRenderer(row, column);
Component c = table.prepareRenderer(cellRenderer, row, column);
int width = c.getPreferredSize().width + table.getIntercellSpacing().width;
preferredWidth = Math.max(preferredWidth, width);
// We've exceeded the maximum width, no need to check other rows
if (preferredWidth >= maxWidth)
{
preferredWidth = maxWidth;
break;
}
}
tableColumn.setPreferredWidth( preferredWidth );
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
/**
* Return the minimum size of the table. The minimum height is the
* row height times the number of rows.
* The minimum width is the sum of the minimum widths of each column.
*/
public Dimension getMinimumSize(JComponent c)
{
long width=0;
Enumeration enumeration=table.getColumnModel().getColumns();
while(enumeration.hasMoreElements())
{
TableColumn aColumn=(TableColumn)enumeration.nextElement();
width=width+aColumn.getMinWidth();
}
Dimension result=createTableSize(width);
result.width+=c.getInsets().left+c.getInsets().right;
result.height+=c.getInsets().top+c.getInsets().bottom;
return result;
}
代码示例来源:origin: net.sf.cuf/cuf-swing
width = Math.max(width, pColumn.getMinWidth());
width = Math.min(width, pColumn.getMaxWidth());
代码示例来源:origin: com.eas.platypus/platypus-js-grid
public final void setTableColumn(TableColumn aColumn) {
if (tableColumn != null) {
tableColumn.removePropertyChangeListener(columnListener);
}
if (aColumn == null && tableColumn != null) {
minWidth = tableColumn.getMinWidth();
maxWidth = tableColumn.getMaxWidth();
if (tableColumn.getHeaderValue() instanceof String) {
title = (String) tableColumn.getHeaderValue();
}
}
tableColumn = aColumn;
if (tableColumn != null) {
tableColumn.addPropertyChangeListener(columnListener);
}
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
private void hideColumn() {
tempWidth = super.getWidth();
tempMinWidth = super.getMinWidth();
tempMaxWidth = super.getMaxWidth();
tempResizable = super.getResizable();
tempMoveable = moveable;
setResizeable(false);
setMoveable(false);
setMinWidth(0);
setWidth(0);
setMaxWidth(0);
}
代码示例来源:origin: mucommander/mucommander
public void copyValues(TableColumn base) {
modelIndex = base.getModelIndex();
identifier = base.getIdentifier();
width = base.getWidth();
minWidth = base.getMinWidth();
setPreferredWidth(base.getPreferredWidth());
maxWidth = base.getMaxWidth();
headerRenderer = base.getHeaderRenderer();
headerValue = base.getHeaderValue();
cellRenderer = base.getCellRenderer();
cellEditor = base.getCellEditor();
isResizable = base.getResizable();
}
}
内容来源于网络,如有侵权,请联系作者删除!