Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7419003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:59:07+00:00 2026-05-29T07:59:07+00:00

I want to add horizontal scrollbars to my JScrollPane, because my table right now

  • 0

I want to add horizontal scrollbars to my JScrollPane, because my table right now looks like the one below:

enter image description here

Here is my code to create the table:

  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);

Can you point out what I’m doing wrong? When I changed the line to create a JScrollPane to:

  this.scrollPane = new JScrollPane(this.table,
    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
    JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

The scrollbars are there, but I still cannot scroll horizontally. See the screenshot below.

enter image description here

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:59:07+00:00Added an answer on May 29, 2026 at 7:59 am

    You have to set for JTable#setAutoResizeMode, more is described in JTable's tutorial Setting and Changing Column Widths

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have dbml with single table users i want add partial class for User
I want to add more than one function to a ViewHelper. Usually there is
i have this $.each(data, function (url) { $(ul).append($(<li class='horizontal'></li>).html(this.title)); }); I want to add
I have made a custom button bar as described here . Now, I want
I want to add auto stretch the content div and add horizontal scroll to
I want to add a horizontal line to the RichTextBox as a delimiter of
I want to know how could I add Horizontal lines to each bar of
I want to add an image in my application which is like a road
I want to add dynamically captured images in hierarchical structure (one after one). I
I have a website built with ASP.NET (3.5) and want add some level of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.