[Divunal-devel] a better text field...

Phil Christensen evil_ivan@yahoo.com
Wed, 4 Aug 1999 05:46:25 -0700 (PDT)


--0-846930886-933770785=:20931
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

This post is a combination bug finding and solution (yay!). The command
line in the client has been acting a little funny, at least for me. On
occaision, you have to press whatever key you want twice to get it to
do it's thing. I notice this most often when the enter key needs
another press to submit the text on the input line. I haven't been able
to figure out precisely why it does this.....BUT............

I've created a rather beautiful subclass of JTextField called
HistoryTextField which is a self-contained little number that does all
the things we need the field to do. It stores a (currently) unlimited
number of history commands, and will replace any arbitrary character
with any other arbitrary String, the latter being either anywhere in
the string or (in our case) at the beginning of the input.

I've attached a zip file with the class and a sample implementation of
its use (in GameWindow.java). I believe the bindings are currently set
up for MOO (i.e. "=say, ;=eval :=emote), but if you take a look at
GameWindow's constructor you will see how easy it is to change that.

I'm particularly pleased with this, since it was such a biznatch to
figure out how to make it do these things (mainly, the character
substitution), and I'm willing to pop it into the Faucet if everyone is
willing. If not, that's fine too, since I have other uses for this as
well...

-phil
_____________________________________________________________
Do You Yahoo!?
Free instant messaging and more at http://messenger.yahoo.com

--0-846930886-933770785=:20931
Content-Type: application/x-unknown-content-type-WinZip; name="HistoryTextField.zip"
Content-Transfer-Encoding: base64
Content-Description: HistoryTextField.zip
Content-Disposition: attachment; filename="HistoryTextField.zip"

UEsDBBQAAAAIAO1DBCcTE71jewYAAD0VAAAPAAAAR2FtZVdpbmRvdy5qYXZh
lVhbT9tIFH4OUv7DaR5ah01toGy12qgPEGChggURtittVa0m9iQZmHgie5zA
Iv77nrnYHsd2ChEJ8cx37reZBMGShA9kRmEhxIom/ixjw+5Od4ctliKRcE9W
xCdr6e8O62t0RePazqOfrlk8qxFkknG92N0JArthZZrVZTbhLISQkzSFP8iC
/s3iSKyBPkoaRyl8PUtwEZCU0wUKTsEALlmKAJoM4CiUTMTFc3en47wArkSW
0hINI4FaxMgpX+vuPCPNV/UI9/wiVuaJ5Am+QEzXoNe9/l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