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

JTextPane in JScrollPanel with large component not drawn properly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 1.3.0
    • client-libs
    • beta
    • x86
    • windows_2000

      Name: yyT116575 Date: 03/28/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
      java full version "1.3.0-C"

      I'm trying to do the following:
      1. Create a JTextPane embedded in a JScrollPanel
      2. Add a component to the JTextPane that is too wide to be displayed.
      3. I expect the JScrollPane Horizontal scrollbars to become visible so I can
      scroll to see the entire component.


      Example Code:

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

      public class temp extends JFrame {
        public temp() {
          initUI();
        }

        public static void main(String[] args) {
          temp newTemp = new temp();
        }

        private void initUI() {
          JTextPane myPane = new JTextPane();
          JScrollPane scrollpane = new JScrollPane();
          scrollpane.getViewport().add(myPane);
          scrollpane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

          this.getContentPane().add(scrollpane);
          JButton wideButton = new JButton("This is a very wide button that is too large to fit on one line within myPane");
          myPane.insertComponent(wideButton);

          this.pack();
          this.setSize(100, 100);
          this.setVisible(true);
        }
      }
      (Review ID: 118234)
      ======================================================================
      ###@###.### 10/13/04 17:57 GMT

            idk Igor Kushnirskiy (Inactive)
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: