Re: Setting the column width size to 'n' number of characters
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 27 Feb 2009 07:31:17 -0800
On Fri, 27 Feb 2009 02:26:34 -0800 (PST), nivedita.jadhav@xxxxxxxxx
wrote, quoted or indirectly quoted someone who said :
I am trying to set the size of a table column. But it takes the column
size in pixel. But my requirement is to set it to display some n
number of characters. Any way of doing it?
You have theoretical problem. Since most of your fonts are variable
pitch how wide is 10 characters? wide enough for ten 'i's or ten 'm's?
Let's say you compromised and made it wide enough for ten x's. Then
when you put 10 'm's in there, they won't fit.
What you might do is use a fixed pitch font, get the FontMetrics and
do the conversion from chars to pixels yourself with a multiplication.
http://mindprod.com/jgloss/fontmetrics.html
See http://mindprod.com/jgloss/monospacedfonts.html
for some possible choices of font. Keep WORA in mind. Only
"Monospaced" is guaranteed available everywhere.
--
Roedy Green Canadian Mind Products
http://mindprod.com
"If everyone lived the way people do in Vancouver,
we would need three more entire planets to support us."
~ Guy Dauncey (born: 1948 age: 61)
.
- References:
- Setting the column width size to 'n' number of characters
- From: nivedita . jadhav
- Setting the column width size to 'n' number of characters
- Prev by Date: Re: Setting the column width size to 'n' number of characters
- Next by Date: Removing Empty Margin Space from JTextField and JLabel
- Previous by thread: Re: Setting the column width size to 'n' number of characters
- Next by thread: Removing Empty Margin Space from JTextField and JLabel
- Index(es):
Relevant Pages
|