Re: Automatically resize font when component size changes?
- From: "Larry Barowski" <MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND>
- Date: Tue, 20 Mar 2007 09:44:48 -0400
<larkmore@xxxxxxx> wrote in message
news:1174397161.494761.84730@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Well, I'm trying to write this to be flexible so I can reuse the code
in the future for other things, like generic title bars, etc. I'm
still stumped on how to find the area to paint, but you might be onto
something with the custom override of paint(). Then I can guarantee
alignment and not worry about getting truncated to "..."
Also, if the font has numbers with different widths (which seems
fairly rare) you still need to paint each number at a fixed position.
You don't want the numbers jumping around when the time changes
the way they would on a JLabel with such a font.
The only
killer like I said was that I'm trying to make this reusable so on a
modern 3Ghz processor it won't really matter, but trying to scale it
to some of the less powerful CPUs found on single board computers or
embedded devices could get messy. But, it is what it is. Thanks
again!
A search for the best font size will take minimal time. You
could optimize that with an initial guess based on the panel
size, followed by something like a proportional search, but
I think you'll find that a simple linear search will be plenty
fast.
.
- References:
- Automatically resize font when component size changes?
- From: larkmore
- Re: Automatically resize font when component size changes?
- From: Andrew Thompson
- Re: Automatically resize font when component size changes?
- From: larkmore
- Re: Automatically resize font when component size changes?
- From: Andrew Thompson
- Re: Automatically resize font when component size changes?
- From: larkmore
- Automatically resize font when component size changes?
- Prev by Date: Re: Automatically resize font when component size changes?
- Next by Date: Re: Automatically resize font when component size changes?
- Previous by thread: Re: Automatically resize font when component size changes?
- Next by thread: Re: Automatically resize font when component size changes?
- Index(es):
Relevant Pages
|