当前位置: 技术问答>java相关
一个关于jtable放置在jscrollpane的问题?
来源: 互联网 发布时间:2015-05-03
本文导语: 每当这样时,jtable的列宽度总是以jscrollpane的宽度等分,如何令jtable宽度大于jscrollpane? | 当然不是, 是 JTable 缺省的 resize 模式不一样. void setAutoResizeMode(int mode) Sets th...
每当这样时,jtable的列宽度总是以jscrollpane的宽度等分,如何令jtable宽度大于jscrollpane?
|
当然不是, 是 JTable 缺省的 resize 模式不一样.
void setAutoResizeMode(int mode)
Sets the table's auto resize mode when the table is resized.
static int AUTO_RESIZE_ALL_COLUMNS
During all resize operations, proportionately resize all columns.
static int AUTO_RESIZE_LAST_COLUMN
During all resize operations, apply adjustments to the last column only.
static int AUTO_RESIZE_NEXT_COLUMN
When a column is adjusted in the UI, adjust the next column the opposite way.
static int AUTO_RESIZE_OFF
Do not adjust column widths automatically; use a scrollbar.
static int AUTO_RESIZE_SUBSEQUENT_COLUMNS
During UI adjustment, change subsequent columns to preserve the total width; this is the default behavior.
剩下的就不用多说什么了.
另外: column 的宽度, 缺省情况下用的都是 TableColumn 的 PreferredSize
最好使用这个来确定宽度.
void setAutoResizeMode(int mode)
Sets the table's auto resize mode when the table is resized.
static int AUTO_RESIZE_ALL_COLUMNS
During all resize operations, proportionately resize all columns.
static int AUTO_RESIZE_LAST_COLUMN
During all resize operations, apply adjustments to the last column only.
static int AUTO_RESIZE_NEXT_COLUMN
When a column is adjusted in the UI, adjust the next column the opposite way.
static int AUTO_RESIZE_OFF
Do not adjust column widths automatically; use a scrollbar.
static int AUTO_RESIZE_SUBSEQUENT_COLUMNS
During UI adjustment, change subsequent columns to preserve the total width; this is the default behavior.
剩下的就不用多说什么了.
另外: column 的宽度, 缺省情况下用的都是 TableColumn 的 PreferredSize
最好使用这个来确定宽度.