[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] FYI: textfield fixes
From: |
Anthony Balkissoon |
Subject: |
Re: [cp-patches] FYI: textfield fixes |
Date: |
Thu, 13 Oct 2005 11:57:11 -0400 |
The first part of this patch was wrong, removing the repaint from
updateDamage. The host container should be repainted if a new line was
added. There is a test case at the bottom of this message demonstrating
that. I reverted that part of the patch.
2005-10-13 Anthony Balkissoon <address@hidden>
* javax/swing/text/PlainView.java:
(updateDamage): Repaint the container if a new line is added.
--Tony (testcase is below)
***TESTCASE***
import javax.swing.*;
public class InsertNewLine
{
public static void main (String[] args) throws InterruptedException
{
JTextArea pane = new JTextArea();
pane.setText("012345678901234567890e");
JFrame jf = new JFrame();
jf.add(pane);
jf.setSize(200,200);
jf.show();
Thread.sleep (4000);
pane.append("\n\nhello");
}
}
On Thu, 2005-10-13 at 12:57 +0000, Roman Kennke wrote:
> Hi,
>
> it seems that my latest patches made swing painting more sensible in
> respect to clipping. This is indeed a good thing, since it can save
> valuable painting time, with optimized components even better. However,
> it uncovers some smaller bugs that are related to clipping. Like this
> one.
>
> There were two reasons why textfields haven't been painted correctly
> after my fixes:
> - the initial allocation for the views didn't respect the insets of the
> text component, so the Graphics clip was initialized slightly off
> - the damageLineInRange method in PlainView only caused the area of the
> line repainted, that is still there, that means, if I have 'abcde' and
> delete the 'e', then only the area of 'abcd' gets repainted, leaving
> the 'e' there. I fixed this by causing the repaint call to cover the
> whole width of the text component (== the whole line). If somebody has a
> clever idea how to optimize this, then say so. I would not consider it
> worth the effort though
>
> 2005-10-13 Roman Kennke <address@hidden>
>
> * javax/swing/text/JTextComponent.java
> (replaceSelection): Removed debug statement.
> * javax/swing/text/PlainView.java
> (updateDamage): Removed unnecessary repaint call.
> (damageLineRange): Trigger repaint over the whole width of the
> text component at the requested line range. Otherwise we might
> not clear deleted text.
> * javax/swing/plaf/basic/BasicTextUI.java
> (DocumentHandler.changedUpdate): Use visibleEditorRect as
> initial allocation.
> (DocumentHandler.removeUpdate): Use visibleEditorRect as
> initial allocation.
> (DocumentHandler.insertUpdate): Use visibleEditorRect as
> initial allocation.
> (getVisibleEditorRect): If component width and height values are
> invalid (==uninitialized), return a Rectangle of (0,0,0,0) instead
> of null.
>
> /Roman
> _______________________________________________
> Classpath-patches mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/classpath-patches
PlainViewRepaintAfterAddition.diff
Description: Text Data