Results 1 to 2 of 2
  1. #1
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Question How can i make this JScrollPane scroll horizontally?

    There seems to be no options for this in netbeans IDE!

    I have a table with too many columns to display, so the columns are getting squished as the table only fills the view of the ScrollPane. How do I make the table exceed the width of the ScrollPane so that the horizontal scrollbar will show up?

    I tried to look this up on google but the tutorials are confusing me.

    I tried to make things happen when the ScrollPane component is shown, like this:

    Java Code:
        private void jScrollPane2ComponentShown(java.awt.event.ComponentEvent evt) {
            jScrollPane2.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
            jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
            jScrollPane2.setViewportView(jTable1);
            jTable1.setSize(1000,jTable1.getHeight());
            jScrollPane2.createHorizontalScrollBar();
        }
    :eek:

  2. #2
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Default

    Hold it....!!! I set "autoResizeMode" to OFF now and its fine now :)

Similar Threads

  1. Moving Scroll in JScrollPane
    By ayesh85 in forum AWT / Swing
    Replies: 0
    Last Post: 03-02-2011, 08:11 AM
  2. Replies: 4
    Last Post: 01-21-2010, 05:46 PM
  3. I want the output to be apper HORIZONTALLY
    By o0oNorao0o in forum New To Java
    Replies: 8
    Last Post: 01-21-2010, 12:24 PM
  4. How to duplicat drawOval horizontally?
    By ntagrafix in forum AWT / Swing
    Replies: 1
    Last Post: 12-03-2009, 09:37 PM
  5. jscrollpane scroll issues
    By kumar_gemi in forum AWT / Swing
    Replies: 11
    Last Post: 09-30-2009, 08:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •