[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: Caret fixes
From: |
Roman Kennke |
Subject: |
[cp-patches] FYI: Caret fixes |
Date: |
Thu, 03 Nov 2005 11:23:13 +0000 |
Hi,
this fixes the blinking stuff in the DefaultCaret implementation as well
as some minor issues. Most importantly, this sets up the blink timer
when first needed, not earlier. Should save some threading/eventqueue
load when setting up a GUI with many text components. Also, this fixes
the conditions when the caret becomes visible by default (it should only
become visible when the focus is gained AND the text component is
editable and enabled). This fix makes the CornerCaret example from the
OReilly Swing book work just fine.
2005-11-02 Roman Kennke <address@hidden>
* javax/swing/text/DefaultCaret.java
(BlinkTimerListener): New inner class. Listens for when the
blink timer fires and updates the visible flag accordingly.
(visible): Default value for visible should be false.
(blinkTimer): New field.
(Caret): New constructor.
(focusGained): Make the caret visible.
(focusLost): Make caret invisible if the focus lost is permanent.
(deinstall): Deinstall the blink timer.
(repaint): Call getComponent() instead of directly accessing the
textComponent field.
(paint): Call getComponent() instead of directly accessing the
textComponent field. Added an assert for the 'this should never
happen' comment. Update the caret rectangle if damage hasn't
been
called before.
(setBlinkRate): Set the blink rate in the timer if there is
already
a timer present.
(setVisible): Call damage on the caret's location. Start/Stop
blink
timer.
(damage): New method. Updates the caret's bounds.
* javax/swing/text/JTextComponent.java
(CaretBlinkTimer): Removed unneeded inner class.
(caretBlinkTimer): Removed unneeded field.
(JTextComponent): Removed initialization of blink timer.
(setEditable): Removed starting of blink timer.
(setCaret): Likewise.
* javax/swing/text/Utilities.java
(getParagraphElement): New utility method.
/Roman
text-caret.diff
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: Caret fixes,
Roman Kennke <=