Workaround for JScrollPane not displaying horizontal scroll bars in Java

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.