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


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

Re: JPanel will not show

From "Ian Wilson" <ian.wilson@THRWHITE.remove-dii-this>
Subject Re: JPanel will not show
Message-ID <rpidnTKne4VqdjDYnZ2dnUVZ8tSdnZ2d@bt.com> (permalink)
Newsgroups comp.lang.java.gui
References <DTfrh.1882$cv2.1419@newsfe13.lga>
Date 2011-04-27 15:29 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
Knute Johnson wrote:
> printdude1968@gmail.com wrote:
> 
>> How do I make my panel appear?  Do I need to add it to the main JFrame,
>
> You make your panel appear by adding it to a top level container and 
> then showing the container.  A top level container is a Frame/JFrame or 
> Window/JWindow.

or a Dialog/JDialog including derivatives such as JOptionPane.showXXX().

> 
> The biggest problem you are going to face is layout managers.  Either 
> you use one or you don't but you can't mix and match.  If you want to 
> lay out your container manually then set it's layout manager to null. 
> Then every component you add will have to have a size and a location set 
> or it will not show up.  I guarantee you that your life will be much 
> better if you don't do that and use an appropriate layout manager instead.

Too many people ignore this. Layout managers are one of the best 
features of Java and make laying out resizable panels so much easier. 
Anyone new to layout managers could start with Sun's online tutorials. 
Anyone struggling with GridBagLayout could look at 3rd party layout 
managers like MigLayout (my favourite) and JGoodies FormLayout.

---
 * 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 | Find similar | Unroll thread


Thread

JPanel will not show  ( a printdude1968@gmail.com.remove-dii-this - 2011-04-27 15:29 +0000
  Re: JPanel will not show "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000
    Re: JPanel will not show printdude1968@gmail.com.remove-dii-this - 2011-04-27 15:29 +0000
      Re: JPanel will not show "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000
        Re: JPanel will not show "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000
          One final question before printdude1968@gmail.com.remove-dii-this - 2011-04-27 15:29 +0000
            Re: One final question be "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000
              Re: One final question be printdude1968@gmail.com.remove-dii-this - 2011-04-27 15:29 +0000
            Re: One final question be "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000
    Re: JPanel will not show "Ian Wilson" <ian.wilson@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000

csiph-web