Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #38313
| From | Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Is there a method to update control size? |
| Date | 2018-05-31 17:20 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <pep3ta$ok0$1@dont-email.me> (permalink) |
| References | <7a7e726d-051d-4f17-93ac-3dabdde80894@googlegroups.com> |
On 2018-05-31 16:34, Eric Douglas wrote: > I create a JLabel. I create a JScrollPane. I call setLayout(new GridLayout()) on the JLabel, then add the JScrollPane to the JLabel. No Window yet, nothing displaying. I call setPreferredSize on the JScrollPane. Is there an easy way to call getPreferredSize on the JLabel to have it's size include the size of the JScrollPane or do I have to manually calculate it at this point? After simply calling setPreferredSize(282,179) on the JScrollPane, the getPreferredSize() on the JLabel is returning java.awt.Dimension[width=4,height=4]. > Why (and how) in the name of Bob would you a) set a layout on a J*Label* b) *add* a JScrollPane to a J*Label* Further, is this again from your code where you are working with fixed-sized layouts? 'Cause if it isn't, I wouldn't recommend setting the sizes yourself, and instead letting the LayoutManagers work with whatever space is allocated to the UI in the Window (either by the user resizing it, or by yourself by setting the size of the Window, and of the window only). I personally am a GridBagLayout aficionado, and would at most size components via weights and fill rules of the various grid elements. -- DF.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is there a method to update control size? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-31 07:34 -0700
Re: Is there a method to update control size? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2018-05-31 17:20 +0200
Re: Is there a method to update control size? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-31 11:28 -0400
Re: Is there a method to update control size? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-31 09:42 -0700
Re: Is there a method to update control size? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2018-05-31 19:22 +0200
Re: Is there a method to update control size? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-31 10:38 -0700
Re: Is there a method to update control size? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2018-05-31 19:45 +0200
Re: Is there a method to update control size? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-31 10:55 -0700
Re: Is there a method to update control size? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2018-05-31 20:05 +0200
Re: Is there a method to update control size? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2018-06-03 15:00 -0500
Re: Is there a method to update control size? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2018-06-04 02:25 +0200
Re: Is there a method to update control size? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-31 15:55 -0400
Re: Is there a method to update control size? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2018-06-03 15:02 -0500
csiph-web