classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: updates to WrappedPlainView and JTextComponent


From: Anthony Balkissoon
Subject: [cp-patches] FYI: updates to WrappedPlainView and JTextComponent
Date: Thu, 03 Nov 2005 14:46:16 -0500

This patch fixes a bug in JTextComponent.select, the end of the
selection is constrained to be >= the start of the selection, not 0.
This is fixed.

I implemented WrappedPlainView.drawLine to properly call
drawUnselectedText and drawSelectedText rather than just drawing the
whole line using drawUnselectedText.  However, this exposed some
problems:

- the method javax.swing.Utilities.drawTabbedText is not returning the
proper value.  This is causing selected and unselected text to overlap.

- the JTextComponent is returning a value for getSelectedTextColor()
that is the same as its selected background color (black) and so the
text can't be seen.  I temporarily fixed this by setting the selected
text to be white, but I'll fix this as soon as I fix the underlying
problem.

After lunch I'll look into the first problem, but if I can't solve it
right away I'll file a bug.
2005-11-03  Anthony Balkissoon  <address@hidden>

        * javax/swing/text/JTextComponent.java:
        (select): The end index cannot be smaller than the start index, changed
        Math.max(end, 0) to Math.max(end, start).
        * javax/swing/text/WrappedPlainView.java:
        (selectionStart): New package private field.
        (selectionEnd): Likewise.
        (drawLine): Implemented to call drawUnselectedText and drawSelectedText
        on the appropriate parts of the line.  Before it just drew the whole
        line with drawUnselectedText.
        (paint): Store the start and end of the selection.
        (WrappedLine.paint): Set the selected color to Color.WHITE.

--Tony


Attachment: WPVDrawSelectedText.diff
Description: Text Data


reply via email to

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