Showing Horizontal scroll bar in JTabel

I am creating a table as follows:
private ResultSetTableModel tableModel;
// create TableModel for results of query
tableModel = new ResultSetTableModel( JDBC_DRIVER, DATABASE_URL, USERNAME, PASSWORD, DEFAULT_QUERY );
// create JTable delegate for tableModel
JTable resultTable = new JTable( tableModel );
sp = new JScrollPane( resultTable);
where
ResultSetTable Model is a class which extends AbstractTableModel
When dispalying the table I can only see the vertical scroll, How can the horizontal scroll be shown??
Thanks.

http://forum.java.sun.com/thread.jspa?forumID=57&threadID=623692

Similar Messages

  • Can we manipulate the Show Horizontal Scroll Bar property during runtime?

    Hi
    i have set the Show Horizontal Scroll bar to true in the property palette during design time but i want to set to false during run-time based on certain conditions.
    it is possible to set the Show Horizontal Scroll Bar property of the forms window to true or false during runtime?
    if yes, how do you do it?
    any help is appreciated. thx.
    Siti

    Hi there
    thank you for the reply.
    so is resizing of canvas using set_canvas_property('CANVAS6',WIDTH,690)
    possible during run-time based on certain conditions? thx.
    Siti

  • Reports doesn't shows horizontal scroll bar after EHP5

    Hi All,
    After EHP5 SP level, under menu MSS -> My Staff -> Reporting, any reports doesn't shows horizontal scroll bar, to view last colums. I tried with Authroziation SAP ALL but still issue persists.
    Thanks,
    Cheers!!!
    Sara

    can you chekc note 1531182
    1. Open SAP Note 19466 - "Downloading SAP kernel patches"
    2. Follow the instructions on the a above note and implement the Kernel
    patches contained on SAP Note 1531182 -  "Number of fixed columns is
    incorrect"

  • JList in JScrollPane never shows horizontal scroll bar

    I have a JList inside a JScrollPane. When I add a lot of cells to the list, the vertical scroll bar appears as expected. However, if I add a cell that would require lots of horizontal space in which to render, the horizontal scroll bar never appears.
    Is there a way to make the JList take on the width of the widest rendered cell?
    Josh

    Here's some code that will demonstrate the problem. Run the code, then resize the window so that the horizontal scroll bar should appear.
    Code for jds.toys.Main:
    package jds.toys;
    import javax.swing.DefaultListModel;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JScrollPane;
    import javax.swing.SwingUtilities;
    public class Main extends JFrame {
         protected DefaultListModel model;
         public Main()
              super("JList in JScrollPane");
              model = new DefaultListModel();
              model.addElement("A very very very very very very long String");
              model.addElement("A very very very very very very very long String");
              model.addElement("A very very very very very very very very long String");
              model.addElement("A very very very very very very very very very long String");
              model.addElement("A very very very very very very very very very very long String");
              model.addElement("A very very very very very very very very very very very long String");
                      JList list = new JList(model);
                      list.setSize(300,300);
                      list.setFixedCellHeight(30);
                      list.setCellRenderer(new MyCellRenderer());
                      JScrollPane scrollPane = new JScrollPane(list);
                      add(scrollPane);
                      setSize(400,400);
        public static void main(String[] args) throws InterruptedException {
             final Main m = new Main();
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                     m.setVisible(true);
    Code for jds.toys.MyCellRenderer:
    package jds.toys;
    import java.awt.Component;
    import java.awt.Graphics;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.ListCellRenderer;
    public class MyCellRenderer extends JPanel implements ListCellRenderer
         private Object currentValue;
         private JList currentList;
         public MyCellRenderer()
         public Component getListCellRendererComponent(     JList list,
                                             Object value,
                                       int index,
                                       boolean isSelected,
                                       boolean cellHasFocus)
              currentValue = value;
              currentList = list;
              return this;
         public void paintComponent(Graphics g)
              int stringLen = g.getFontMetrics().stringWidth(currentValue.toString());
              int ht = currentList.getFixedCellHeight();
              g.setColor(getBackground());
              g.fillRect(0,0,stringLen,ht);
              g.setColor(getForeground());
              g.drawString(currentValue.toString(),0,ht/2);
    }

  • TreeTable not showing horizontal scroll bar on Chrome

         Hi experts,
    I'm coding a treeTable and it Works just fine on Internet explorer,
    I'm creating a SDK component for Design Studio and the version of SAPUI5 it carries is 1.12.7
    I can't use a newer version, is there any way to fix this?
    Best Leandro

    if (!!sap.ui.Device.browser.webkit
      && !document.width) {
      jQuery.sap.require("sap.ui.core.ScrollBar");
      var fnOrg = sap.ui.core.ScrollBar.prototype.onAfterRendering;
      sap.ui.core.ScrollBar.prototype.onAfterRendering = function() {
      document.width = window.outerWidth;
      fnOrg.apply(this, arguments);
      document.width = undefined;
    This code solved the problem. Thanks

  • Horizontal scroll bar for the adf page

    Hi,
    We have around 7 tables in single jsff page. Here , we have a requirement like :
    We need to show horizontal scroll bar for the entire page instead of each table. Is there any way to get this.
    As of now, we have horizontal scroll bar for each table, but our customer is not accepting this, that want the scroll bar for the entire page.
    Please suggest the approach.
    Thanks

    I have grouped all the tables in panelgrouplayout.So, what is the problem (because it is not quite clear what you need)?
    If your PanelGroupLayout is with layout="horizontal", then the tables will be rendered next to each other horizontally but there will be no horizontal scrollbar on the page.
    If your PanelGroupLayout is with layout="scroll", then the tables will be next to each other vertically and there will be a horizontal and a vertical scrollbar on the page (if necessary).
    If you need your tables to be relocated next to each other horizontally and to have a horizontal scrollbar on the page, then use a PanelGroupLayouts(horizontal) inside a PanelGroupLayout(scroll):
    <af:panelGroupLayout layout="scroll">
      <af:panelGroupLayout layout="horizontal">
        <af:table> ... </af:table>
        <af:table> ... </af:table>
        <af:table> ... </af:table>
      </af:panelGroupLayout>
    </af:panelGroupLayout>If your problem is that you still have horizontal scrollbars inside the tables, then you should set appropriate widths to the corresponding tables (e.g. to <af:table> tags) such that they are large enough to fit the sum of corresponding column widths.
    ya, I know that its not god design, but its customer requirement, so we need to do that.If you expect some table(s) to be stretched automatically according to the size of browser's window, then you should re-think your UI design because PanelGroupLayouts do not stretch their children. A possible solution is to use a combination of PanelSplitters or other layout containers that stretch their children.
    Dimitar

  • Horizontal scroll bar not appeating in af:treeTable

    We have an af:treeTable component in a popup with two af:column.
    Issue:
    1. af:treeTable is not showing horizontal scroll bar. When i set the width to a fixed value say 1000 on af:column c171, it shows scroll bar but the size is fixed.
    This is not the solution, because if the length of #{node.TerrDimMemberHierarchy} exceeds this size again some portion of it becomes invisible.
    Question:
    1. How can i make horizontal scroll bar appear in tree table. And also it should grow or shrink depending upon the length of #{node.TerrDimMemberHierarchy}
    data.
    <af:treeTable rowBandingInterval="0" id="tt2"
    fetchSize="25"
    inlineStyle="width:38em; height:28em; border-width:1px; border-style:groove;"
    partialTriggers="::dimensionDropDown ::searchButton ::cb5"
    rowSelection="multiple"
    value="#{backingBeanScope.ManageTerritoriesBean.dimensionMemberSearchTreeTableTreeModel}"
    var="node"
    visible="#{pageFlowScope.searchString != null ? (pageFlowScope.viewInHierarchyBtnLbl == null ? true : false) : false}"
    columnStretching="column:c171"
    binding="#{backingBeanScope.ManageTerritoriesBean.dimensionMemberSearchTreeTable}"
    summary="#{salesterrmgmtterritoriesuiGenBundle['OLabel.AvailableDimensionMembers']}"
    immediate="true"
    selectionListener="#{backingBeanScope.ManageTerritoriesBean.dimensionMemberSearchTreeListener}"
    styleClass="AFStretchWidth">
    <f:facet name="nodeStamp">
    <af:column sortable="false" id="c14"
    rowHeader="unstyled"
    headerText="#{salesterrmgmtterritoriesuiAttrBundle['ColAttr.Name.DimensionName.MOTTERRDIMENSIONSVL.NAME']}">
    <af:outputText value="#{node.Name}" id="ot15"/>
    </af:column>
    </f:facet>
    <af:column sortable="false" id="c171"
    headerText="#{dlBndl.PATH}"
    styleClass="AFStretchWidth">
    <af:outputText value="#{node.TerrDimMemberHierarchy}"
    id="ot16"/>
    </af:column>
    </af:treeTable>
    Edited by: sekare on Aug 29, 2011 4:01 AM

    can u remove the styleClass="AFStretchWidth" for af:column
    AFStretchWidth is for table or treetable to stretch.. not for columns
    <af:column sortable="false" id="c171"
    headerText="#{dlBndl.PATH}"
    styleClass="AFStretchWidth">

  • Horizontal Scroll bar in a list Box?

    Hi,
    I have a requirement in Adobe Designer where my List Box should also show Horizontal Scroll bar in it.
    Is it possible?
    Thanks.

    Thanks Debadas,
    But i need both (Horizontal & Vertical) the scroll bars and depending on the data length either or both should be visible, without changing the data visiblity or text rotation.
    Regards,

  • TableView and horizontal scroll bar

    Hi
    I need to show horizontal scroll bar in my TableView - there are many columns in my view. I tried to put it into the ScrollPane but it takes no any effect.. Is there any ability to make scrollable treeview via FXML layout file?
    My code is
    <ScrollPane fitToHeight="true" fitToWidth="true" hbarPolicy="ALWAYS" VBox.vgrow="ALWAYS">
    <content>
    <TableView fx:id="resultsTbl">
    <columns>
    <TableColumn text="col 1" prefWidth="60" />
    <TableColumn text="col 2" prefWidth="60" />
    <TableColumn text="col 3" prefWidth="130" />
    ........cut....
    </columns>
    <items>
    </items>
    </TableView>
    </content>
    </ScrollPane>
    Thanks
    Edited by: 918392 on 02.03.2012 4:51

    OK. If I understand you correctly, you want the table view to fill the scroll pane width when the total column width is less than the scroll pane width, but show a scroll bar when the total column width is greater than the scroll pane width. Is that right? If so, I don't believe that is currently supported. I think there is a feature request for it, but JIRA is down right now so I can't tell for sure.
    Feel free to submit a feature request for this if you like, and we'll mark it as a duplicate if necessary.

  • 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 not showing in PO

    Hi Experts,
    I'm unable to see the Horizontal scroll bar in PO item overview..so unable to see all the columns..is there any setting for that ???so that I can use it again ...

    Hi,
    Click 'Table Control Settings' icon (press the button on the top-right
    hand of the item details area you're referring to - the icon is 3
    columns with a a yellow first column)
    In the 'Administrator' area there is a setting here in the section
    'Further settings', with a field 'No. of fixed columns'.
    Check the value here.Make it to 2 and activate.You should be able to see the scroll bar now.
    Regards,
    Ashwini.

  • 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 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

Maybe you are looking for