🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2452

Re: isLowerCase Question

#2452
From: Johan Forsberg
Date: Sat, 02 Dec 2000 00:00
24 lines
1443 bytes
"James A. Schulz" <jaschulz@wiseware.com> skrev i meddelandet
news:9065om$cqo1@bornews.inprise.com...
> Michael,
>
> Thanks, I see.  I am getting the hang of this slowly.  Is what I have the
> "right" way to force input to upper case?
Not really. For instance that won't work for pasted text.

The prferred way to do this kind of thing is to create a custom Document:


class MyDocument extends PlainDocument {
  public void insertString(int offs, String str, AttributeSet a)
           throws BadLocationException {
    if (str==null) {
      super.insertString(offs, str, a);
      return;
    }
    str = str.toUpperCase();
    super.insertString(offs, str, a);
  }
}
jTextField1.setDocument(new MyDocument());
Technical Details
Message-ID: <90b028$can7@bornews.inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <9062ve$srb10@bornews.inprise.com> <3a2694d1_1@dnews> <9065om$cqo1@bornews.inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,c04b680deb5c80d6
X-Google-Attributes: gid1089d0,public
From: "Johan Forsberg" <jfo@SPAMfinansforbundet.SPAMse>
Subject: Re: isLowerCase Question
Date: 2000/12/02
Message-ID: <90b028$can7@bornews.inprise.com>
X-Deja-AN: 700285423
Content-Transfer-Encoding: 7bit
References: <9062ve$srb10@bornews.inprise.com> <3a2694d1_1@dnews> <9065om$cqo1@bornews.inprise.com>
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
X-Priority: 3
Content-Type: text/plain; charset="Windows-1252"
Mime-Version: 1.0
X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
Newsgroups: borland.public.jbuilder.java.api