• Subject: Re: How to create your own numeric components ?
  • From: "Luther Ananda Miller" <luther.miller@xxxxxxxxxx>
  • Date: Fri, 21 Jan 2000 10:08:18 +0100
  • Organization: HYPERe


Glad to hear you have found a solution! Subclassing PlainDocument is a good
idea. It just occurred to me -- you might want to override replaceString as
well. I think replaceString will be called if someone selects part of your
string and then pastes other text into it, although I am not 100% sure.


----- Original Message -----
From: Geert Van Landeghem <gvl@reynderseti.be>
To: <JAVA400-L@midrange.com>
Sent: Friday, 21 January 2000 9:08
Subject: RE: How to create your own numeric components ?

> Luther,
> I think I found a better way to create numeric components:
> by creating a subclass of PlainDocument and overriding
> the insertString() method to accept only digits and a separator.
> I found an example in JFC Unleashed and it works fine! The big advantage
> of working with a subclass of PlainDocument is that it can also be used
> other
> text components to accept only numeric input.
> When creating a JRNumField that acts like a packed decimal 6,2 field
> I now have to use the following code:
>   JRNumField txf_myfield=new JRNumField(6,2,'.');
>   // the setDocument(new PackedFilterDocument(this)) is executed in the
> constructor
>   // of JRNumField class
>   // add the component to the layout ...
> For those interested I added the code of my own PackedFilterDocument

| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.