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


Groups > comp.lang.java.programmer > #38314

Re: Is there a method to update control size?

Path csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Is there a method to update control size?
Date Thu, 31 May 2018 11:28:32 -0400
Organization A noiseless patient Spider
Lines 26
Message-ID <pep4b3$qnp$1@dont-email.me> (permalink)
References <7a7e726d-051d-4f17-93ac-3dabdde80894@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 31 May 2018 15:28:35 -0000 (UTC)
Injection-Info h2725194.stratoserver.net; posting-host="33fe12e34126543c71c0cde7edf0af02"; logging-data="27385"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MdEMegZmv2p+y3yL2kW1F"
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0
Cancel-Lock sha1:4k4D2nou3O2yGkXWg+IqPBSX0VQ=
In-Reply-To <7a7e726d-051d-4f17-93ac-3dabdde80894@googlegroups.com>
Content-Language en-US
Xref csiph.com comp.lang.java.programmer:38314

Show key headers only | View raw


On 5/31/2018 10:34 AM, 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.

     Right here is where I simply must ask: "Why?"  Why not just put
the scroll pane wherever you were going to put the label?  (Or, why
not put the label-plus-scroll as the content of another label, and
put that as the content of yet another label, and ...?)

> I call setPreferredSize on the JScrollPane.

     Odd.  If you're scrolling something, the more typical approach
is to size the viewport (either directly, or by having the scrolled
client state a preference), and just let the scroll pane figure out
the overall size.

     By the way: What kind of client does the scroll pane scroll?

     Have you read

https://docs.oracle.com/javase/tutorial/uiswing/components/scrollpane.html

?

-- 
esosman@comcast-dot-net.invalid
Nine hundred sixty-five days to go.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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