Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2449

how to get rid of trailin

From "Ray Ma" <ray.ma@THRWHITE.remove-dii-this>
Subject how to get rid of trailin
Message-ID <1189799300.384653.116230@50g2000hsm.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
Date 2011-04-27 15:39 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
Hi, there,

I thought this would be simple but I didn't find any answer by
searching.

My problem is not how to restrict user input to JTextField to a fixed
length.
The problem is, I need the JTextField to be almost exactly the same
length as the column of characters I entered.

I have set the allowed text input length to be 8 for example by using:

JTextField textField.setColumn(8);
textFieldContainerPanel.validate();

and I can see that the textField does shrink a little bit compare to
when I use setColumn(20); It does only allow user input to 8
characters.
But after I finish entered 8 characters from left to right, there's
still some blank space between the 8th character to the right edge of
the textField. (around 5 characters) It seems that the textField
layout manager always tries to leave more space than it needs for just
holding the "column" number of characters.

There is previous post:
http://groups.google.com/group/comp.lang.java.gui/browse_thread/thread/977cea7ef7745570/ac4fab7e991e768f?lnk=gst&q=JTextField+length&rnum=8#ac4fab7e991e768f

that suggest to get a hold of the Font object, can someone give more
detail on this method if appropriate?

same question asked at:
http://forum.java.sun.com/thread.jspa?threadID=701287&messageID=4068100
with no answer.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextNext in thread | Find similar | Unroll thread


Thread

how to get rid of trailin "Ray Ma" <ray.ma@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
  Re: how to get rid of tra "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000

csiph-web