Horizontal scroll bar is in JTable

I am doing following code to set horizontal and vertical scroll bar to Table. vertical is working nicely but horizontal is not added to table and all colum of table got shrink and hardly visible. so i want to set horizontal scrollbar as needed.
how can that possible. looking for response
mTable.setPreferredScrollableViewportSize(new Dimension(TABLE_WIDTH, TABLE_HEIGHT));
mTable.setRowHeight(TABLE_ROW, TABLE_ROWHEIGHT);
mTable.getTableHeader().setResizingAllowed(false);
mTable.setGridColor(Color.darkGray);
mTable.getTableHeader().setReorderingAllowed(false);
mScrollPane = new JScrollPane(mTable);
mScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
mScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
Message was edited by:
Prashant_SDN

that looks odd. what is wrong in this case
Nothing's wrong. The columns all start up with the same default width.
If you want it fitted to width on being shown and then become adjustable then you should invoke that change in a listener which executes when the component is shown (the reliable way to do this is use a HierarchyListener which checks isShowing() and then executes if that's true, then deregisters itself).

Similar Messages

  • No horizontal scroll bar on the Jtable. In order to see long column.....

    No horizontal scroll bar on the tJable.
    In order to see long cell data we have to eliminate other columns of the table.
    I need an horizontal scroll bar on the JTable if the data in a cell is longer.
    Could somebody help me out?
    Thanks in advance.

    in the jtable use following method :
    myTable.setAutoResizeMode(this.AUTO_RESIZE_OFF);
    KR,
    Jan

  • Horizontal scroll Bars not coming in JTable

    Hi,
    If a user streches any column of the jtable to the right such that its values are not visible properly. Then should the horizontal scroll bar come in the scrollpane in which table is there.??
    If Yes then how can I do it?
    I have seen when no of rows becomes more than the display area of the table then vertical scrollbar are coming automatically. but not Horizontal scroll bars.
    Please help

    sorry for my previous mistype, here is the right solutions to your problem.
    As default the JTable will auto resize your column width, if you want horizon scrollbar
    you must do following below steps:
    JTable tableview = new JTable (model) ;
    tableview.setAutoResizeMode (JTable.AUTO_RESIZE_OFF) ;
    JScrollPane scrollpane = new JScrollPane (tableview,
    ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
    ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED) ;
    JPanel p ;
    p.add (scrollpane) ;
    This can works for you !

  • JTabel Horizontal scroll bar problem

    Hi,
    I want a horizontal scroll bar added to my table
    hence I do this
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    but the problem is If I increase the size of frame
    the cells do not resize hence there is a gap after
    the last column.
    How do I remove this gap

    Please reduce the container size in the screen thru SE51 that automatically create the scroll
    or check whether in the attributes of the screen "Hold scroll positio" not to be checked

  • Horizontal Scroll Bar does not show

    I have a method which creates a table with values and displays it in a dialog. However, the horizontal scroll bars do not appear, even though there is are columns that are not seen in the view. Here is my code:
         private void setTable()
              Object columns[] = headerLST.toArray(),
                        rows[][] = new Object[rowLST.size()][headerLST.size()];     
              for(int x = 0; x < rowLST.size(); x++)
                   java.util.List list1 = (java.util.List)rowLST.get(x);
                   for(int y = 0; y < list1.size(); y++)
                        rows[x][y] = (String)list1.get(y);     
              DefaultTableModel tValues = new DefaultTableModel(rows, columns);
    JTable tableA = new JTable(tValues);
         tableA.setRowHeight(27);
                   tableA.setRowSelectionAllowed(false);
                   tableA.setColumnSelectionAllowed(false);
                   tableA.setFont(new Font("Dialog", Font.BOLD, 12));
              int minColWidth = 120, maxColWidth = 200;
              for(int y = 0; y < tableA.getColumnCount(); y++)
                   TableColumn tbc = tableA.getColumnModel().getColumn(y);
                   tbc.setPreferredWidth(minColWidth);     
                   tbc.setMinWidth(minColWidth);
                   tbc.setMaxWidth(maxColWidth);
              scrollA = new JScrollPane(tableA);
              this.getContentPane().add(scrollA, BorderLayout.CENTER);
    Can someone tell me what I am missing?
    Thanks
    Augustine

    You need this
    tableA.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    otherwise it will always try and fit the table to the space available

  • Horizontal scroll bar at top in JScrollPane

    Hi,
    How can i get the horizontal scroll bar to be on the top instead of bottom
    here is my code
    TableModel tableModel = new TableModel(totalData,
    columnHeader);
    JTable table = new JTable(tableModel);
    JScrollPane scrollPane = new JScrollPane(table);
    Ashish

    Hi Ash
    I dont know whether this is feasible please sorry if i am wrong.
    Create a JPanel and add scroll bar to the left and top.
    I have posted a Q in the subject JDialog Esc Key. please answer the Q for me.
    Lakshmi.

  • Getting a horizontal scroll bar in the DHTML_SHUTTLE

    Hello,
    We are currently using Carl's DHTML_SHUTTLE procedure to display some shuttles.
    I have a problem where the data is longer than the width of the shuttle and was wondering if it is possible to implement a horizontal scroll bar so that the user can see it?
    Thanks,
    Paul

    alisadri wrote:
    Hi there,
    I have created a JScrollPane object for a JTable. Using the code below, I am trying to create a horizontal scroll pane for the JTable object but the horizontal
    bar doesn't move at all. this is the code. Also when I create the horizontal bar as "AS_NEEDED" the horizontal bar does not appear. The vertical bar works
    properly. Can someone help me with this please.
    This is the Code:
    loadTableScrollPane = new JScrollPane(getLoadTable()); //"getLoadTable()" return a JTable object.
    loadTableScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    loadTableScrollPane.setViewportView(getLoadTable());
    loadTableScrollPane.setBounds(new Rectangle(5, 149, 1135, 232));
    Just a wild guess ... because you do need to post a real example - but get rid of the setBounds and setPreferredSize and use pack() on the frame.

  • Can't see the horizontal scroll bar in the scroll pane.

    Hi there,
    I have created a JScrollPane object for a JTable. Using the code below, I am trying to create a horizontal scroll pane for the JTable object but the horizontal
    bar doesn't move at all. this is the code. Also when I create the horizontal bar as "AS_NEEDED" the horizontal bar does not appear. The vertical bar works
    properly. Can someone help me with this please.
    This is the Code:
    loadTableScrollPane = new JScrollPane(getLoadTable()); //"getLoadTable()" return a JTable object.
    loadTableScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    loadTableScrollPane.setViewportView(getLoadTable());
    loadTableScrollPane.setBounds(new Rectangle(5, 149, 1135, 232));

    alisadri wrote:
    Hi there,
    I have created a JScrollPane object for a JTable. Using the code below, I am trying to create a horizontal scroll pane for the JTable object but the horizontal
    bar doesn't move at all. this is the code. Also when I create the horizontal bar as "AS_NEEDED" the horizontal bar does not appear. The vertical bar works
    properly. Can someone help me with this please.
    This is the Code:
    loadTableScrollPane = new JScrollPane(getLoadTable()); //"getLoadTable()" return a JTable object.
    loadTableScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    loadTableScrollPane.setViewportView(getLoadTable());
    loadTableScrollPane.setBounds(new Rectangle(5, 149, 1135, 232));
    Just a wild guess ... because you do need to post a real example - but get rid of the setBounds and setPreferredSize and use pack() on the frame.

  • Help with code for inserting horizontal scroll bar in photo gallery in Business Catalyst site?

    Hi,
    I am using Business Catalyst and Dreamweaver to create a trial site.
    I am not sure if this is the correct forum to post this request but anyway I have inserted a photo gallery module at the bottom of the sidebar in the homepage of my test site.
    Can anyone advise on whether jquery or any other code can be inserted into the page or module code that will replace the "next" hyperlink below the first 4 photos with a horizontal scroll bar at bottom of the gallery so users can just scroll through all 12 images ?
    Kind Regards, Matt.
    http://craftime-bs6.businesscatalyst.com/

    Alyssa,
    Have you tried putting this rule back as it was originally:
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
        left: auto; /*was 9px*/
        color: #EF9CCF;
        background-color: #FFF;
    That is, changing your 9px back to auto.
    And giving  us a link (as you did) is much better than printing out the code for us! Thanks!
    Beth

  • How to get the Horizontal Scroll Bar for a Table?

    Hi All,
    As per my requirement, I am displaying several records in a Screen in a Tabular Format. But here I have to show 21 Columns in that table which is too high. I am able to display it but due to it I am getting a Horizontal scroll bar for the whole screen since all the columns are not getting displayed in the normal window screen space. But its looking too odd since once I am scrolling it to right the columns are getting displayed but the above Header Bar and Global buttons are not displaying, they are bound to the normal screen space.
    Is there a way to have a Horizontal scroll bar only for that table instead of the entire screen so that on scrolling that bar only the table rows will beshifted ant got displayed?
    With Thanks
    Kumar Gautam

    try this approach.
    include a raw text item before and table item.
    include the appropriate HTML tags in raw text item to enable horizontal scroll
    --Prasanna                                                                                                                                                                                                                                                                                                                                   

  • How do I view the Horizontal Scrolling bar and status bar at the bottom of the screen. I can only see the top menus, toolbars and vertical scroll bar?

    Before the most recent upgrade, the bottom horizontal scrolling bar and status bar appeared on my screen. Now since upgrading, I cannot see the. Anyone ideas how to restore them?

    If you haven't already, you could force-quit Quicktime by using the menu option from the desktop (finder) and choose Quicktime.
    Not sure what you have frozen on the screen, be it a failed movie, or some unusual screen shot. If you can find by date (created) you may be able to look for .mov or quicktime suffix name or other video file content to delete it.
    And you may have to restart your computer and perhaps run repair disk permissions from Disk Utility's first aid on the hard disk drive in your computer.
    Not sure if all that would help now, but it is something a few days late...!
    Good luck & happy computing!

  • Horizontal Scroll Bar

    I have this site that I'm practicing on called
    Massattack Studios,
    it's been a work in progress for a while experimenting with Flash
    and Dreamweaver 8.
    In internet explorer my scroll bar situation works fine, in
    Fire Fox the unwanted horizontal scroll bar appears. At least at
    the moment I'm not concerned with other browsers. Can anybody tell
    me how to get rid of that little guy?
    I'm looking at the Validator and it is very overwealming to
    me as a beginner with the code.
    Any help would be great, i can post anything you may need to
    figure it out, thank you very much!
    This is my main index page...
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <title>Massattack Studios</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    </head>
    <frameset cols="*,650,*" border="0">
    <frame src="left.htm" name="left" marginwidth="0"
    marginheight="0" scrolling=no>
    <frameset rows="100,*,25" border="0">
    <frame src="head.htm" name="head" marginwidth="0"
    marginheight="0" scrolling=no noresize>
    <frame src="home.htm" name="MainFrame" scrolling="yes"
    noresize="noresize" marginwidth="0" marginheight="0"
    id="MainFrame">
    <frame src="footer.htm" name="footer" marginwidth="0"
    marginheight="0" scrolling=no noresize>
    </frameset>
    <frame src="right.htm" name="right" marginwidth="0"
    marginheight="0" scrolling=no noresize>
    </frameset>
    <noframes><body>
    </body></noframes>
    </html>

    In the home.htm file that loads into your main frame, change
    the DOCTYPE.
    CHANGE:
    !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
    TO THIS:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
    Transitional//EN">BTW:
    "Bumbing" has no effect in the NNTP forums where most of the
    answers come
    from and it's just annoying to the web form user who are
    patiently waiting
    for a response.

  • My horizontal scroll bar went missing when I maximise the window. How do I fix them?

    My horizontal scroll bar went missing when I maximise the window. How do I fix them? I tried everything; such as auto hide the task bar. Even with this, I still can't see the horizontal scroll bar. I even tried the following and I still can't see the horizontal scroll bar.
    1) In a new tab, type or paste about:config in the address bar and press Enter. Click the button promising to be careful.
    (2) In the search box above the list, type or paste dom and pause while the list is filtered
    (3) Double-click the dom.disable_window_open_feature.scrollbars preference to switch it from false to true. By choosing true, you disable sites from deciding whether there can be scrollbars on a window, and Firefox uses its standard behavior for the page.
    If you want to always get other bars, here are the corresponding settings:
    Menu Bar: dom.disable_window_open_feature.menubar
    Navigation Toolbar: dom.disable_window_open_feature.toolbar
    Bookmarks Toolbar: dom.disable_window_open_feature.personalbar
    Please help.

    Can you post a screen shot?
    Taking a Screen shot; '''''Windows > Start >''''' search box '''''> Snipping Tool'''''.
    Save the picture(s) to your desktop. Now look at the '''Reply''' box below.
    Do you see the button under it that says '''Browse'''? Click it and then select
    the screen shot(s) from the desktop.

  • How to make the knob of a horizontal Scroll Bar stay at right

    Hi I need some advise to achieve this:
    I have a chart continuously deploying towards the right side (think on an electro cardiogram that is continuously feeding data). All the chart information is kept available inside a JScrollPane. What I want to achieve is:
    1. if the horizontal scroll bar knob is at the right end of the scroll bar make the end part of the chart be displayed continuously (view is scrolling to the right, the knob stays at the right end)
    2. if the user moves the knob left from the right end freeze the motion and just show the selected portion (meanwhile data keeps being fed and stored but not displayed)
    3. when the user decides to drag the knob again to the right end the behavior of point # 1 resumes.
    The basic swing structure I'm using for this is the following:
    public class Electro extends JPanel {
    public Electro() {
    JFrame f = new JFrame();
    JScrollPane sp = new JScrollPane(this);
    f.getContentPane().add(sp);
         f.pack();
         f.setVisible(true);
    I would highly appreciate any feedback from fellow members. Thank you.

    hi friend
    try this in ur code
    public class Electro extends JPanel {
    public Electro() {
    JFrame f = new JFrame();
    JScrollPane sp = new JScrollPane(this);
    sp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    sp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    f.getContentPane().add(sp);
    f.pack();
    f.setVisible(true);
    i think it will be help full to you
    thanks
    waiting for reply

  • Some web sites do not display a horizontal scroll bar but IE does

    For example: http://shop.ghirardelli.com/category-exec/category_id/35/nm/Sale/?utm_source=chocomail&utm_medium=pos1_save10-30DL&utm_campaign=20111124

    That site uses CCS code (overflow-x:hidden) to hide the horizontal scroll bar.<br />
    It is also missing in Google Chrome.

Maybe you are looking for

  • Frozen on Screen Saver - Mac Book Pro Retina, precursor to something bad?

    My Macbook Pro Retina, 10.8.2, went into Screen Saver mode, "Shifting Tiles", while I way away from my computer. Upon my return I was meet with a black screen and where the images for the "shifting tiles" would be were black boxes with an oily rainbo

  • Office 2013 macro warnings GPO

    How do we enable all macros to run that are stored from our LAN? At the moment we receive warning below the ribbon in excel and word advising that some content maybe dangerous and to enable macros. Also we receive a Security warning after enabling ma

  • Help Connecting A Stateless Session Bean To MySQL Database

    Hi, I'm trying to connect a simple stateless session bean that has been deployed using the admin console to a MySQL database that has been set up and pinged using the JDBC Resources/Connection Pools part of the admin console. When I attempt to connec

  • How much is an ipad 3 screen replacement uk

    My son got new ipad for Christmas, only present from whole family I may add, he fell and cracked the screen any idea how much a replacement screen would be ?

  • IPod touch wheel and iPod software version 1.5

    Hi, I have a problem with my iPod touch wheel (20 GB). I have purchased some music on the iTMS this days, but i was unable to transfer it to my Ipod, which software version was 1.4. So, I decide to restore the iPod with the latest version for this mo