Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1242
| From | "larkmore" <larkmore@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Automatically resize |
| Message-ID | <1174397161.494761.84730@y80g2000hsf.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <1174394826.700580.311100@y80g2000hsf.googlegroups.com> |
| Date | 2011-04-27 15:32 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui 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 "..." 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! -Will On Mar 20, 8:47 am, "Andrew Thompson" <andrewtho...@gmail.com> wrote: > 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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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