Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4382001

Horizontal Scrollbar in JScrollPane with JTable not visible

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.3.0
    • client-libs



      Name: yyT116575 Date: 10/23/2000


      compiler output:

      c:\Programme\jdk1.3\bin\javac.exe ScrollPane.java
      Working Directory - C:\Programme\jdk1.3\lib\TestClass Path - D:\WisOra81\orb\classes\yoj.jar;D:\WisOra81
      \orb\classes\share.zip;.;c:\Programme\Kawa4.0
      \kawaclasses.zip;c:\programme\jdk1.3\lib\tools.jar;c:\programme\jdk1.3
      \jre\lib\rt.jar;c:\programme\jdk1.3\jre\lib\i18n.jar
      File Compiled...
      No Errors...

      I'm trying to get a horizontal JScrollBar in a JScrollPane with a JTable.
      The method scrollpane.setHorizontalScrollBarPolicy(ScrollPaneConstants.
      HORIZONTAL_ SCROLLBAR_ALWAYS) sets a horizontalScrollBar but it is not
      scrollable becaus the knob is missing. I've tried different source code
      solutions which have been offered in the forums. None of them helped me solve
      my problem. Here's my code:

      ***********************
      import javax.swing.*;
      import javax.swing.table.*;
      import java.awt.*;


      class test2
      {
        JTable table = new JTable(50, 15);
        JScrollPane scrollpane = new JScrollPane(table);
        JPanel jp2 = new JPanel();
        JFrame frame = new JFrame();

        test2()
        {
          table.setPreferredSize(new Dimension(200,300));
          table.setMinimumSize(new Dimension(200,300));
          table.setMaximumSize(new Dimension(200,300));
          table.setAutoResizeMode
          (table.AUTO_RESIZE_ALL_COLUMNS);

          JScrollPane scrollpane=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
              JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

          scrollpane.setPreferredSize(new Dimension(200,300));
          scrollpane.setMinimumSize(new Dimension(200,300));
          scrollpane.setMaximumSize(new Dimension(200,300));
          scrollpane.getViewport().add(table);
          scrollpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
          scrollpane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);

          jp2.add(scrollpane);
          frame.getContentPane().add(jp2);
          frame.pack();
          frame.show();
        }
        
        public static void main(String args[])
        {
         test2 mytest = new test2();
        }
      }

      I have no idea how to solve this problem. I hope You can help me. Thank You in
      advance!
      (Review ID: 110433)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: