bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug swing/27393] JTextArea.setText("") hangs.


From: thebohemian at gmx dot net
Subject: [Bug swing/27393] JTextArea.setText("") hangs.
Date: 3 May 2006 18:30:08 -0000


------- Comment #9 from thebohemian at gmx dot net  2006-05-03 18:30 -------
Here is some explanation I found useful for this problem:
-------------------------
Hi,
the attached patch fixes PR 27393. As said in one comment one reason for the
hang is that DefaultCaret will create a (zero-sized) selection (= highlight) as
soon as someone sets the dot. This was once thought to be good for performance
(less object instantiations) but triggered some problems in the
javax.swing.text.View classes which occur when the allocation area is empty.

Getting the View (and related) classes to act in a proper way in Classpath is a
bit difficult as their behavior is not specified and I have to find out what
they should do by writing little BeanShell scripts, run them on the RI, call
various View class methods with funny arguments and note how they react. I did
such a try-and-error session for BasicTextUI and WrappedPlainView now and fixed
them according to my findings.

The result is that Audrius' earlier fix is not neccessary as this should be
handled by now in a different way: If the allocation area is empty (this would
trigger the endless loop) the method WrappedPlainView.WrappedLine.modelToView
throws a BadLocationException.

The patch contains a change to BasicTextUI.getVisibleEditorRect() to return
null instead of an empty Rectangle if the component's area is empty (width or
width being zero). This has some consequences: BasicTextUI.modelToView() should
not forward the call to the RootView but insertUpdate, removeUpdate and
changeUpdate should expect the allocation areas shape to be null.

-----------------

Otherwise this PR is now fixed.


-- 

thebohemian at gmx dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27393





reply via email to

[Prev in Thread] Current Thread [Next in Thread]