本文整理了Java中javax.swing.table.TableColumn.getMaxWidth()
方法的一些代码示例,展示了TableColumn.getMaxWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableColumn.getMaxWidth()
方法的具体详情如下:
包路径:javax.swing.table.TableColumn
类名称:TableColumn
方法名:getMaxWidth
暂无
代码示例来源:origin: ron190/jsql-injection
/**
* Calculate the width based on the widest cell renderer for the
* given column.
*/
private int getColumnDataWidth(int column) {
if (! this.isColumnDataIncluded) {
return 0;
}
int preferredWidth = 0;
int maxWidth = this.tableAdjust.getColumnModel().getColumn(column).getMaxWidth();
for (int row = 0 ; row < this.tableAdjust.getRowCount() ; row++) {
preferredWidth = Math.max(preferredWidth, this.getCellDataWidth(row, column));
// We've exceeded the maximum width, no need to check other rows
if (preferredWidth >= maxWidth) {
break;
}
}
return 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: com.eas.platypus/platypus-js-grid
public int getMaxWidth() {
if (tableColumn != null) {
return tableColumn.getMaxWidth();
} else {
return maxWidth;
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
boolean isColumnVisible(TableColumn column) {
return column.getMaxWidth() > 0;
}
代码示例来源:origin: xyz.cofe/gui.swing
public int getMaxWidth() {
return tableColumn.getMaxWidth();
}
代码示例来源:origin: SKCraft/Launcher
private int getColumnDataWidth(int column) {
if (!isColumnDataIncluded) return 0;
int preferredWidth = 0;
int maxWidth = table.getColumnModel().getColumn(column).getMaxWidth();
for (int row = 0; row < table.getRowCount(); row++) {
preferredWidth = Math.max(preferredWidth, getCellDataWidth(row, column));
// We've exceeded the maximum width, no need to check other rows
if (preferredWidth >= maxWidth)
break;
}
return preferredWidth;
}
代码示例来源:origin: net.sf.kerner-utils/kerner-utils
private int getColumnDataWidth(final int column) {
if (!isColumnDataIncluded)
return 0;
int preferredWidth = 0;
final int maxWidth = table.getColumnModel().getColumn(column).getMaxWidth();
for (int row = 0; row < table.getRowCount(); row++) {
preferredWidth = Math.max(preferredWidth, getCellDataWidth(row, column));
// We've exceeded the maximum width, no need to check other rows
if (preferredWidth >= maxWidth)
break;
}
return preferredWidth;
}
代码示例来源:origin: kaikramer/keystore-explorer
private int getColumnDataWidth(int column) {
if (!isColumnDataIncluded) {
return 0;
}
int preferredWidth = 0;
int maxWidth = table.getColumnModel().getColumn(column).getMaxWidth();
for (int row = 0; row < table.getRowCount(); row++) {
preferredWidth = Math.max(preferredWidth, getCellDataWidth(row, column));
// We've exceeded the maximum width, no need to check other rows
if (preferredWidth >= maxWidth) {
break;
}
}
return preferredWidth;
}
代码示例来源:origin: bspkrs/MCPMappingViewer
private int getColumnDataWidth(int column)
{
if (!isColumnDataIncluded)
return 0;
int preferredWidth = 0;
int maxWidth = table.getColumnModel().getColumn(column).getMaxWidth();
for (int row = 0; row < table.getRowCount(); row++)
{
preferredWidth = Math.max(preferredWidth, getCellDataWidth(row, column));
// We've exceeded the maximum width, no need to check other rows
if (preferredWidth >= maxWidth)
break;
}
return preferredWidth;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javaee-project
public static void updateColumnWidths(JTable table) {
double pw = table.getParent().getSize().getWidth();
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
TableColumn column = table.getColumnModel().getColumn(1);
int w = ((int) pw / 2) - 1;
if (w > column.getMaxWidth()) {
w = column.getMaxWidth();
}
column.setWidth(w);
column.setPreferredWidth(w);
w = (int) pw - w;
column = table.getColumnModel().getColumn(0);
column.setWidth(w);
column.setPreferredWidth(w);
}
代码示例来源:origin: com.synaptix/SynaptixSwing
/**
* Return the maximum size of the header. The maximum width is the sum of
* the maximum widths of each column (plus inter-cell spacing).
*/
public Dimension getMaximumSize(JComponent c) {
long width = 0;
Enumeration enumeration = footer.getTable().getColumnModel()
.getColumns();
while (enumeration.hasMoreElements()) {
TableColumn aColumn = (TableColumn) enumeration.nextElement();
width = width + aColumn.getMaxWidth();
}
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: com.eas.platypus/platypus-js-forms
public static boolean skipableColumn(TableColumn tc) {
return (tc.getWidth() == 0 && tc.getMinWidth() == 0 && tc.getMaxWidth() == 0);
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
/**
* Return the maximum size of the header. The maximum width is the sum
* of the maximum widths of each column (plus inter-cell spacing).
*/
public Dimension getMaximumSize(JComponent c)
{
long width=0;
Enumeration enumeration=header.getColumnModel().getColumns();
while(enumeration.hasMoreElements())
{
TableColumn aColumn=(TableColumn)enumeration.nextElement();
width=width+aColumn.getMaxWidth();
}
return createHeaderSize(width);
}
代码示例来源: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: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
/**
* Return the maximum size of the table. The maximum height is the
* row heighttimes the number of rows.
* The maximum width is the sum of the maximum widths of each column.
*/
public Dimension getMaximumSize(JComponent c)
{
long width=0;
Enumeration enumeration=table.getColumnModel().getColumns();
while(enumeration.hasMoreElements())
{
TableColumn aColumn=(TableColumn)enumeration.nextElement();
width=width+aColumn.getMaxWidth();
}
Dimension result=createTableSize(width);
result.width+=c.getInsets().left+c.getInsets().right;
result.height+=c.getInsets().top+c.getInsets().bottom;
return result;
}
代码示例来源: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();
}
}
内容来源于网络,如有侵权,请联系作者删除!