Add a table in the JPanel, the table is too many things, need horizontal scroll bar sliding to fully find all the data, if there is no horizontal scroll bar, data stacked together, cannot be separated
The practice is:
First step: The table automatically adjusts the state to close off: Table.setautoresizemode (Jtable.auto_resize_off);
The second step: set JScrollPane horizontal scroll bar way, there are three kinds, set JS is a JScrollPane object
Js.sethorizontalscrollbarpolicy (jscrollpane.horizontal_scrollbar_as_needed); Set the horizontal scroll bar to be visible when needed
Js.sethorizontalscrollbarpolicy (Scrollpaneconstants.horizontal_scrollbar_never); Setting the horizontal scroll bar is not visible
Js.sethorizontalscrollbarpolicy (scrollpaneconstants.horizontal_scrollbar_always); Setting the horizontal scroll bar is always visible
The above two steps can solve the situation that the horizontal scroll bar does not display
Reference: http://shaoqxn.blog.163.com/blog/static/4305373720115991135657/
52485998
Workaround for JScrollPane not displaying horizontal scroll bars in Java