JDK-4039177 : TextArea has a size limitation on Win32??
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1,1.1.5
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_95
  • CPU: x86
  • Submitted: 1997-03-15
  • Updated: 1998-01-23
  • Resolved: 1998-01-23
Related Reports
Duplicate :  
Description
Name: sgC58550			Date: 03/14/97


To repeat the problem, run the applet and hit the SEND button several
times to start many threads. We have seen it lock up when the SEND
button was hit only once (i.e. 2 new threads) but it happens much faster
when the SEND button is hit several times.

import java.applet.*;
import java.awt.*;

public class AppletClient extends Applet
{
static Frame f = new Frame();
static TextArea ta = new TextArea(5, 75);

public void init()
{
  setLayout(new BorderLayout());
  add("North", new Button("SEND"));
  f.setLayout(new BorderLayout());
  f.add("Center", ta);
  f.resize(300, 400);
  f.setBackground(Color.green);
  f.show();
}

public boolean action(Event evt, Object arg)
{
  if (arg.equals("SEND"))
  {
    Displayer ac1 = new Displayer("Argentina", this);
    Displayer ac2 = new Displayer("Ethiopia", this);
    ac1.start();
    ac2.start();

  }
  else return super.action(evt, arg);
  return true;

}
        public synchronized void DisplayResults(String name, Thread t)
//      public void DisplayResults(String name, Thread t)
        {
                for (int i=1; i <= 5; i++)
        {
                ta.appendText("i="+i+" "+name+" "+t.toString() +"\n");
                        t.yield();
        }
        }
}

class Displayer extends Thread
{
        private String name;
        AppletClient a;

        public Displayer(String n, AppletClient caller)
        {
        name = n;
        a = caller;
        }

        public void run()
        {
                for (;;) {
                        a.DisplayResults(name, this);
                        try { sleep(2000); } catch (InterruptedException e) {}
                }
        }
}
-- 

======================================================================

Comments
EVALUATION This has nothing to do with threads. TextArea on Win32 seems to have a size limitation for when it will stop scrolling text that is displayed. Works fine on Solaris. To reproduce, run the users program appletviewer and hit the SEND button. The TextArea starts displaying text and scrolling up, but after a while it stops scrolling -- but the program is still running because if you cut some text from the TextArea, it will scroll some more. [I've verified that the program is indeed running with print statements.] I _think_ this might be related to the lots-of-text in text area problem reported by one user -- fwiw, I've attached it in the comments. anand.palaniswamy@Eng 1997-07-23 There is a limitation on the amount of text a Win95 edit window can hold. Microsoft has set this limit at 32K, minus some overhead. Attempts to load more than 32K into a text area can produce strange behavior, although it should be possible to load in up to 64K if the TextArea is in read-only mode. A Work-around would be to use the Java-based text components supplied with Swing. eric.hawkes@eng 1998-01-23
23-01-1998

WORK AROUND Use the Java-based text components supplied in Swing. Swing can be downloaded from http://java.sun.com/jdc/. eric.hawkes@eng 1998-01-23
23-01-1998