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 8465697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:07:29+00:00 2026-06-10T15:07:29+00:00

I am making a dialog for the purpose of selecting multiple file paths. My

  • 0

I am making a dialog for the purpose of selecting multiple file paths. My dialog consists of two panels. One for buttons such as “Add” and “Remove”, and a second panel containing a JTable wrapped in a scrollPane. The table has only one column. The cells of the table are not editable directly. When a user selects a file using a JFileChooser, the full path of that file will be added to the table. Although my dialog is resizeable, I still need a horizontal scroll behavior in the event that the file path is longer than the user’s screen is wide.

I have researched the combination of resizeable table and horizontal scroll bar. That is similar, but not my issue. The typical scroll behavior is that the columns are scrolled, not the contents of the columns. I need the contents of a single column to scroll horizontally.

  • 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-06-10T15:07:30+00:00Added an answer on June 10, 2026 at 3:07 pm

    doesn’t matter whether you scroll a multiple or only a single column: the basic issue is to get the horizontal scrollBar to start with 🙂

    There are two screws to tweak:
    – enable horizontal scrolling by setting the table’s resizeMode: default is to always fit the table’s size to the size of the scrollPane, that is no scrolling
    – resize the column width to fit its content

    In a core JTable that maps into pseudo-code like

    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    // on receiving a TableModelEvent which might increase the column width
    // calculate new width by measuring pref of the renderer
    int newWidth = ... 
    // set it as pref of the column 
    table.getColumnModel().getColumn(0).setPreferredWidth(newWidth);
    

    The catch is that without resizeMode, you are always responsible to sizing the column: it its width is less than the scrollPane, there’s an empty region at its trailing side.

    JXTable (part of SwingX project), supports an addition sizing mode which fills the available horizontal space as long as the table’s prefWidts is less than parent width and shows a horizontal scrollBar if needed

    table.setHorizontalScrollEnabled(true);
    // on receiving a TableModelEvent which might increase the column width
    // tell the table to re-evaluate 
    table.packColumn(0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a custom login dialog, similar to the one found on http://www.primefaces.org/showcase/ui/dialogLogin.jsf
I am making a dialog to overlay upon the screen when the phone needs
Which do you think are best practices for making a windows dialog compatible both
I'm making a custom error dialog in my WPF app and I want to
I'm concerned that when I use Facebook's feed dialog I'm making my App Id
So, I'm busy making a model viewer, I'm trying to get my dialog properly
I have a jQuery dialog for making links in a contentEditable span. The problem
I'm making a non-rectangular dialog, modelled over an image from Photoshop (the image is
I ma making a game, and I want to pull the apprpriate dialog from
I tried making a dialog using jquery it works but I have no succes

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.