我感觉好象jtable的宽度没法大于jscrollpane的宽度,大了岂不是出来滚动条了
如果你要是想改变jtable的列宽度
tbl.getColumnModel().getColumn(1).setWidth(100);//改变第一列的宽度
如果你要是想改变jtable的列宽度
tbl.getColumnModel().getColumn(1).setWidth(100);//改变第一列的宽度
解决方案 »
- [求助]这个网络编程的程序为什么会出问题?
- 我新来的菜鸟,问个简单的float和double的问题,谢谢大家帮我看看
- 按钮拖放后存在的问题(望高手救人)
- 学生可以根据系统中的课程列表选择自己中意的课程;可以查看该课程的教师信息。查询课程列表和查询所选课程信息。数据都在文件中(增、删、修改)。
- 请教简单问题:JCreator、Ant、IntelliJ IDEA分别是哪些公司开发的?
- 高分求教redhat9.0上数据库连接出现的问题 The Network Adapter could not establish the connection !
- 访问数据库老是有错误,大侠请指点啊!
- 不知道错在什么地方了,在线等
- 问候大家!
- 求解:有一个jar文件,我用什么解开它,使他展开,然后在运行?
- 在linux下如何安装jdk
- 我元气大伤,没分了,各位老大赏个光,进来瞧瞧
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
最好使用这个来确定宽度.