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


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

Re: Container Question. P

From "Thomas Fritsch" <thomas.fritsch@THRWHITE.remove-dii-this>
Subject Re: Container Question. P
Message-ID <newscache$rihdcj$5e4$1@news.ops.de> (permalink)
Newsgroups comp.lang.java.gui
References <45aee8f5_2@news.tm.net.my>
Date 2011-04-27 15:29 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
gg wrote:

> How come this...
> ----------------------------------
> public class MainFrame extends JFrame {
[...]
>          this.setLayout(new BorderLayout());
>          this.add(panelOne, BorderLayout.NORTH);
[...]
> ----------------------------------
> Work just as well, what is the container for, it seems to work without 
> it. Any problems if I don?t use it. Thank you for you help.
> 
> public class MainFrame extends JFrame {
[...]
>          Container container = this.getContentPane();
>          container.setLayout(new BorderLayout());
>          container.add(panelOne, BorderLayout.NORTH);
[...]
> ----------------------------------

It was a difference until Java 1.4 (only the second variant did work).
It is no difference since Java 1.5 (both variants work).

See <http://java.sun.com/j2se/1.5.0/docs/guide/swing/1.5/index.html> (look
for 4753342) and
<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4753342>

-- 
Thomas

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


Thread

Re: Container Question. P "Thomas Fritsch" <thomas.fritsch@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000

csiph-web