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


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

Re: Limit size of JOption

From "visionset" <visionset@THRWHITE.remove-dii-this>
Subject Re: Limit size of JOption
Message-ID <vvRSh.154$633.40@newsfe4-gui.ntli.net> (permalink)
Newsgroups comp.lang.java.gui
References <1176230836.660006.261610@w1g2000hsg.googlegroups.com>
Date 2011-04-27 15:33 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui

<oddstray@gmail.com> wrote in message 
news:1176230836.660006.261610@w1g2000hsg.googlegroups.com...
> Hi,
>
> I'm using a JTextArea inside a JScrollPane inside a JPanel as the
> "msg" field in a JOptionPane.  Trouble is, my JTextArea has many
> lines, and the JOptionPane expands to accommodate it.  I need to limit
> the height of my JOptionPane, but for the life of me I can't find the
> magic combination of layouts and set<something>Size calls that works!

JScrollPane sp = ...
sp.setPrefrerredSize(new Dimension(sp.getPreferredSize().width, myHeight);

Just take the default FlowLayout of JPanel this will respect PreferredSize.

-- 
Mike W

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

Limit size of JOptionPane "oddstray" <oddstray@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
  Re: Limit size of JOption "visionset" <visionset@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
    Re: Limit size of JOption "oddstray" <oddstray@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
      Re: Limit size of JOption "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000

csiph-web