JDK-4200316 : Features missing in Document & Element
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1999-01-03
  • Updated: 2001-10-10
  • Resolved: 2001-10-10
Related Reports
Duplicate :  

Name: dbT83986			Date: 01/03/99

The default Element for PlainDocument and other Document models 
allow deleting everything, there is no way to specify that an 
Element should not be editable.  What I am looking for is a way 
to fix characters/Elements to a position in the Document that 
will not change.  At the moment this cannot be done without a 
custom document, CaretListener and a KeyPressed listener on a 
custom text component (which wouldn't work anyway because 
of the KeyTyped event bug).  
The examples in the tutorial for FormattedDocument under the 
section 'Creating a Validated Textfield' and the TextSamplerDemo
illustrate the problems with the features I think are missing.  
The cursor can get stuck in the WholeNumber textfield in the 
position where the Format is expecting a sign (delete everything 
in the field).  Also the comma delineated number never works 
after the text is initially displayed.  Icons can be deleted 
from the text in the TextSamplerDemo and text does not 'flow'
around the icon when it is dropped into the document.
I believe the latter is part of the design problem which does 
implement any means of doing a type over.  The Insert key does 
not toggle Insert/Overtype on off either.
Anyway, my suggestion for a feature is to have part of the 
default Element attribute include the option of setting an  
Element's length to a fixed number of characters and to be 
able to set whether or not it is editable/deletable.  The 
defaults would be the existing behavior.
(Review ID: 48239)

EVALUATION In merlin we added JFormattedTextField, as part of this we added support for DocumentFilter, which can be plugged into an existing AbstractDocument. DocumentFilter allows you to make portions of the document effectively read only. ###@###.### 2001-10-10