font.point change during runtime in a JTextField

Hello,In a JFrame I have a JTextField. I want if the textbox contains a few characters the size of the Font to be big else if the number of the characters is big the the size of the Font to be small. Any ideaI hope my message make sense in the English Language
[281 byte] By [Guestiosa] at [2007-11-27 9:58:57]
# 1

What's wrong with using setFont, an if condition and the appropriate listener, in this case a CaretListener?

final JTextField field = new JTextField();

field.addCaretListener( new CaretListener() {

Font big = new Font("Verdana", Font.PLAIN, 13);

Font small = new Font("Verdana", Font.PLAIN, 9);

public void caretUpdate(CaretEvent e) {

if(field.getText().length() > 30) {

field.setFont( small );

} else {

field.setFont( big );

}

}

} );

ICE

icewalker2ga at 2007-7-13 0:29:51 > top of Java-index,Desktop,Core GUI APIs...