Computer Science Canada

Swing help needed...

Author:  Jodo Yodo [ Thu Apr 07, 2005 6:20 pm ]
Post subject:  Swing help needed...

code:
JPanel northPanel = new JPanel ();
        JPanel ratingPanel = new JPanel ();

        northPanel.setLayout (new BorderLayout ());
        northPanel.add ("North", movieBox);

        ratingPanel.setLayout (new BorderLayout ());
        ratingPanel.add ("East", currentRating);

        getContentPane ().add (northPanel);
        getContentPane ().add (ratingPanel);

        pack ();
        setVisible (true);


For some reason, it will display the panel 'ratingPanel', but never the panel 'northPanel'. When I use delete all the lines that are about 'ratingPanel', 'northPanel' shows up just fine. Why won't they both show up?

Author:  rizzix [ Thu Apr 07, 2005 8:17 pm ]
Post subject: 

never use "strings" literals for that kind of stuff. always use the Class provided constants.

In this case for "North" it would be BorderLayout.NORTH


: