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

Horizontal SCROLL BAR goes beyond the length of messages.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 2.0_beta18, 1.2.0
    • client-libs

      It seems as though the horizontal scroll bar is of fixed length. For a short message it is possible for the user to scroll beyond the length of the message. These should be adjusted automatically to the longest message in the list.

      When the scroll bar is to the rightmost side, the longest message should be displayed at the end of it - No extra white space.

      TO REPRODUCE
      ==============
      Open the 'Details' window for some host.
      Click on the 'Logview' TAB.
      Scroll to the right.
      Notice messages have ended but you can still scroll to the right.

                                                                        peter.scott@Eng 1998-08-27 This problem can be traced to the JTextArea component. Even if a horizontal scrollbar is specified on an 'as needed' basis, the text area created is about twice the width it needs to be. If a set size is specified for the panel, then the horizontal scroll bar appears with plenty of empty white space on the right. In the test case below, I'm using the first couple messages from my /var/adm/messages file for data. import java.io.*;
      import java.awt.*;
      import com.sun.java.swing.*;

      public class Test {
          public static void main(String args[]) {

          String buf = "Aug 23 03:13:05 venezia snmpdx: error while receiving a pdu fr
      om symax.164: The message has a wrong version (2)\nAug 23 03:15:05 venezia last
      message repeated 4 times";
              Frame f = null;

              JFrame jf = new JFrame();
              JPanel p = new JPanel();
              JTextArea ta = new JTextArea(buf.toString());
              JScrollPane sp = new JScrollPane(ta,
                  ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                  ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
              p.add(sp);

              jf.getContentPane().add(p);
              jf.pack();
              jf.validate();
              jf.show();
          }
      }

            sswingtrsunw Swingtraq Swingtraq (Inactive)
            chyi Chen Yi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: