classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: textfield fixes


From: Roman Kennke
Subject: [cp-patches] FYI: textfield fixes
Date: Thu, 13 Oct 2005 12:57:00 +0000

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

Attachment: textfixes.diff
Description: Text Data


reply via email to

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