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

Call JTextArea.append(String) then resize the window causes IllegalArgumentExcep

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.1.5
    • 1.1.2, 1.1.3
    • client-libs
    • None
    • 1.1.5
    • sparc
    • solaris_2.5

      Call JTextArea.append(String) then enlarge the window in south direction cause "java.lang.IllegalArgumentException: inconsistent values" and the scoll bars becomes misplaced. This bug only show on Solaris. It works fine on Win32.

      To reproduce this bug, please run the following code. Push "start" button then resize the window in south direction.

      import java.io.*;
      import java.awt.*;
      import java.awt.event.*;
      import com.sun.java.swing.*;

      public class myTest extends JPanel
      {
        JTextArea tArea ;

        public static void main(String[] args){

          WindowListener l = new WindowAdapter() {
            public void windowClosing(WindowEvent e) {System.exit(0);}
          };
          
          JFrame f = new JFrame();
          f.addWindowListener(l);

          f.add( new myTest());
          f.pack();
          f.show();
        }

        myTest() {
          // Create GUI components
          
          JButton startButton = new JButton("Start");
          JButton clearButton = new JButton("Clear");
          tArea = new JTextArea();

          // Add Listener
          startButton.addActionListener( new ActionListener() {
            public void actionPerformed(ActionEvent e) {
      try {
      byte[] ba = new byte[2];
      FileInputStream ff = new FileInputStream("myTest.java");

      while ( ff.read(ba) != -1 ) {
      tArea.append(new String(ba) );
      }
      }catch ( Exception ee ) {
      ee.printStackTrace();
      }

            }
          });

          clearButton.addActionListener( new ActionListener() {
            public void actionPerformed(ActionEvent e) {
      tArea.setText("");
            }
            
          });

          // layout
          this.setLayout(new BorderLayout());
          this.add("North", startButton);
          this.add("Center", tArea);
          this.add("South",clearButton);

        }
      }

            tprinzing Tim Prinzing (Inactive)
            pchusunw Patience Chu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: