BJ *_*ruz 2 java swing jtable jscrollpane
我想在我的JScrollPane中添加水平滚动条,因为我的表现在看起来如下所示:

这是我创建表的代码:
this.table = new JTable();
this.table.setShowGrid(false);
this.table.getTableHeader().setFont(ReportViewConstants.TABLE_FONT);
this.table.setFont(ReportViewConstants.TABLE_FONT);
this.scrollPane = new JScrollPane(this.table);
Dimension size = new Dimension(300, 400);
this.scrollPane.setPreferredSize(size);
this.scrollPane.setMinimumSize(size);
this.scrollPane.getViewport().setBackground(Color.WHITE);
Run Code Online (Sandbox Code Playgroud)
你能指出我做错了什么吗?当我更改行以创建JScrollPane时:
this.scrollPane = new JScrollPane(this.table,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
Run Code Online (Sandbox Code Playgroud)
滚动条在那里,但我仍然无法水平滚动.请参见下面的截图.

谢谢!