Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #170
| From | "Ian Wilson" <ian.wilson@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Windows XP Platform L |
| Message-ID | <pdKdnQASm9vYXfvYnZ2dnUVZ8s2dnZ2d@bt.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <ek68js$rfo$03$1@news.t-online.com> |
| Date | 2011-04-27 15:25 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui
Karsten Lentzsch wrote:
> Ian Wilson wrote:
>
>> I have now tried that (see test app [1] below) but didn't see any
>> difference in the button margins. I've had a quick glance at the Looks
>> docs but don't yet see where I am going wrong.
>
>
> You must configure the options before you set the look&feel.
> Move the line "Options.setUseNarrowButtons(false);" up.
>
Thanks Karsten, I can now see the effect.
>> In my real app, to get equal sized buttons, I am doing this:
>> Dimension buttonSize = (
>> new JButton("XXXXXXXX")).getPreferredSize();
>> okButton.setPreferredSize(buttonSize);
>> cancelButton.setPreferredSize(buttonSize);
>> This is horrible but will suffice until I find something better, or
>> until I need to localize the label text, or ... :-)
>
>
> I won't say the above is horrible; it'll scale with
> the hardware resolution and font - a good thing.
> The width you measure is close to 48 DLU.
> But don't use this as preferred size, use it
> as minimum size if the layout manager honors that.
I find it interesting that, by default, JButtons have minimumSize =
preferredSize = maximumSize.
My superficial testing yesterday suggested that BoxLayout sizes buttons
to their maximumSize, FlowLayout sizes buttons to their preferredSize
and GridLayout ignores everything (happily making buttons bigger than
their maximumSize). GridBag, of course, is more complicated :-)
I'll do more testing with minimumSize - thanks for the tips (and of
course for JGoodies Looks etc)
---
* 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 | Find similar
Windows XP Platform Look "Ian Wilson" <ian.wilson@THRWHITE.remove-dii-this> - 2011-04-27 15:25 +0000
Re: Windows XP Platform L "Karsten Lentzsch" <karsten.lentzsch@THRWHITE.remove-dii-this> - 2011-04-27 15:25 +0000
Re: Windows XP Platform L "Ian Wilson" <ian.wilson@THRWHITE.remove-dii-this> - 2011-04-27 15:25 +0000
Re: Windows XP Platform L "Karsten Lentzsch" <karsten.lentzsch@THRWHITE.remove-dii-this> - 2011-04-27 15:25 +0000
Re: Windows XP Platform L "Ian Wilson" <ian.wilson@THRWHITE.remove-dii-this> - 2011-04-27 15:25 +0000
csiph-web