bug-classpath
[Top][All Lists]
Advanced

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

[Bug swing/24650] JTextField refuses to accept any input if initially se


From: audriusa at bluewin dot ch
Subject: [Bug swing/24650] JTextField refuses to accept any input if initially set to the empty string.
Date: 3 Nov 2005 14:51:51 -0000


------- Comment #4 from audriusa at bluewin dot ch  2005-11-03 14:51 -------
Created an attachment (id=10124)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10124&action=view)
Proposed patch to fix this bug (under discussion).

Our JTextField contains an "imaginary" end of line character (0xA), but the new
text must be always inserted before it, not after. When clicking right from the
last character in the field, the PlainTextView.viewToModel should return the
position before the end of line character and not after the end of line
character. Otherwise the inputs blocks. If the empty field receives focus by
the mouse click, the caret position is always set after the 0xA and, a result,
it is never possible to enter any text in the field.

The bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24650 has the uploaded test
case, demonstrating this problem.

This path fixes the problem by introducing the following rule: if the last
character under the mouse click is 0xA, it should not be taken into
consideration, the pre-last character must be returned instead (the 0xA is a
dimensionless character anyway).

With this patch, I "revived" the text fields in my application. In the swing
activity board, now it is possible to enter the text after clicking the mouse
RIGHT from the "Hello world" in the text field demo. The work of the rest of
Swing seems not broken, despite it would be nice if somebody else could check
this as well.

2005-11-03  Audrius Meskauskas  <address@hidden>

PR swing/24650
* javax/swing/text/PlainView.java (viewToModel)):
The end of line symbol (0xA), if being the last member in the obtained text,
should not be counted.


-- 


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





reply via email to

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