JTable 表头不显示问题 …
来源:互联网 发布:淘宝几件包邮怎么设置 编辑:程序博客网 时间:2024/06/05 16:55
JTable组件显示数据时,如果直接将其放置在Frame的contentPane中则表头一行会显示不出来,如果将其放置在JScrollPane中显示数据的话,表头会自动显示出来。
引用Sun的原话为:
It's easy to put a table in ascrollpane. You need just one or two lines of code: The scroll pane automatically gets the table's header, whichdisplays the column names, and puts it on top of the table. Evenwhen the user scrolls down, the column names remain visible at thetop of the viewing area. The scroll pane also tries to make itsviewing area the same as the table's preferred viewing size. Theprevious code snippet sets the table's preferred viewing size withtheJScrollPane scrollPane = new JScrollPane(table);table.setPreferredScrollableViewportSize(new Dimension(500, 70)); setPreferredScrollableVi
ewportSize method. If you're using a table without a scroll pane, then you must getthe table header component and place it yourself. For example:
container.setLayout(new BorderLayout());container.add(table.getTableHeader(), BorderLayout.PAGE_START);container.add(table, BorderLayout.CENTER);在使用时要注意!
0 0
- JTable 表头不显示问题 …
- JTable(swing)不显示表头
- [Swing]JTable 表头显示问题
- JTable 显示隐藏列
- eclipse 调试 悬浮 变量 不显示 无…
- ALV 金额、数量 显示不…
- JTable不显示的问题
- Jtable表头换行显示
- 关于java代码jtable不显示表头的解决
- Lesson 75 Uncomfortable shoes 不…
- java swing-JTable
- 总结: 数塔问题 --> dp 问题 (终…
- conky 温度不显示
- 关于JTable不能显示表头的问题(个人小结)
- 解决Swing JTable表头无法显示的问题
- Showing JTable Header Without Using JScrollPane java中的JTable不显示表头的原因
- JTable中怎样显示表头
- JTable不能正常显示表头
- dialog位置
- jquery dialog 最大最小化按钮
- MySQL错误:access denied&nb…
- JQuery UI Layout
- JS ===用法
- JTable 表头不显示问题 …
- IE6,IE7下overflow:hidden无效&nb…
- JTable 显示隐藏列
- jsp页面包含含有中文的html页面出现乱码的解决方法(转载)
- Linux命令大全,久了不用就生疏,…
- 工厂模式:通过字符串获取与该字符…
- DIV的内容自动换行
- 卸载自带或安装JDK,安装JDK
- Oracle管理员创建用户,表,以及插…