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


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

Re: Automatically resize

From "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Subject Re: Automatically resize
Message-ID <1174394826.700580.311100@y80g2000hsf.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
References <1174393441.687014.66540@n59g2000hsh.googlegroups.com>
Date 2011-04-27 15:32 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
On Mar 20, 11:24 pm, larkm...@aol.com wrote:
> Thanks Andrew, but I kind of hoping there would be something a little
> simpler.  I've already looked at the FontMetrics as described in my
> first post.  

Huhh.. I missed that important detail.

>..If I use that, I would have to:

(snip process)
..only glanced at it, but it sounds about right.

> What I'm looking for is a way to drastically speed up this process so
> I have the user resize the control on the fly without tanking the CPU.

I suspect that any method of determining
the text size, would ultimately come back
to calling those same FontMetrics methods.

This almost smacks of 'premature optimisation'.
Try it, and see if the CPU does bog down. I'll
almost bet it has no appreciable effect, if the
methods are only called when required (e.g.
display size changing*).

The only other thing I can think of to mention,
is that perhaps a JLabel is too complex a
component to be using for this particular use.
I would be tempted to simply use a JPanel and
override paintComponent() directly.

* As as aside, why and when does the diplay
size change?  Is it based upon the user
dragging the display bigger/smaller, or
is it more like a menu item that offers
a small number of preset sizes?
Something else?

Andrew T.

---
 * 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