Determining if a text field is displaying all it's text

Hi,

I have a text field with some text in it that is too long for the text field to display. I was wondering if there was a way of determining if the text is too long for the display field without having to go into getting the size, font, and calculating from font metrics?

thanks,

J

[308 byte] By [justinlawlera] at [2007-11-27 6:36:55]
# 1
sorry, it's a JLabel, not a JTextField (its in a JTable)...
justinlawlera at 2007-7-12 18:05:04 > top of Java-index,Desktop,Core GUI APIs...
# 2
Try comparing the number of characters in the string against the number of display columns for the textfield.i.e. string.length() > textfield.getColumns()ICE
icewalker2ga at 2007-7-12 18:05:04 > top of Java-index,Desktop,Core GUI APIs...
# 3

> Try comparing the number of characters in the string against the number of display columns for the textfield.

Will only work when using a monospaced font. When using a proportional font multiple "i"s will take up less space than multiple "w"s.

> (its in a JTable)...

Compare the preferred size of the renderer with the width of the TableColumn.

camickra at 2007-7-12 18:05:04 > top of Java-index,Desktop,Core GUI APIs...