Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1243

Re: Automatically resize

From "Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this>
Subject Re: Automatically resize
Message-ID <J6ydndu8McqceGLYnZ2dnUVZ_qyjnZ2d@comcast.com> (permalink)
Newsgroups comp.lang.java.gui
References <1174397161.494761.84730@y80g2000hsf.googlegroups.com>
Date 2011-04-27 15:32 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui

<larkmore@aol.com> wrote in message 
news:1174397161.494761.84730@y80g2000hsf.googlegroups.com...
> 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.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Automatically resize font "larkmore" <larkmore@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
  Re: Automatically resize "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
    Re: Automatically resize "larkmore" <larkmore@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
      Re: Automatically resize "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
        Re: Automatically resize "larkmore" <larkmore@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
          Re: Automatically resize "Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
      Re: Automatically resize "bcd" <bcd@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
        Re: Automatically resize "John W. Kennedy" <john.w..kennedy@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000

csiph-web