At 08:48 AM 3/12/2001, Josh Howe wrote:
>I need to put a single line text input field on my user interface. I also
>need to apply a stlye, like strikeout or bold, to the character the user
>enters. I can get the style working in a JTextPane, but how do I get it to
>be the right size for the height of single character. I can play with
>setPreferredSize() until it looks good, but what if a one of my users has
>different sized fonts or something?

You can override the getPreferredSize() method and have it return an 
adjusted dimension based on the currently active font.  You can also force 
a know font (see 
<http://java.sun.com/j2se/1.3/docs/guide/intl/physicalfont.html>).

>Another sort of related question. How can a extend JButton to get it to
>support styled text? I know that I can just use HTML, but I'd like to use
>styled text instead.

May I ask why you don't want to use HTML? Under the surface, when it comes 
to simple styling issues, HTML is treated pretty much like styled 
text.  One can think of it as a convenient non-programmatic way of 
specifying what formatting you want to apply.

Cheers
Dmitry

_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to