日期:2014-05-20  浏览次数:20750 次

why I can't adding a window to a container
源程序如下:

import   java.awt.*;
import   java.awt.event.*;
import   javax.swing.*;

public   class   ComCountry   extends   JFrame   implements   ItemListener
{
private   String[]   flagTitle   =   { "Canada ",   "China ",   "Denmark ",
        "France ",   "Germany ",   "India ",   "Norway ",   "United   Kingdom ",
        "United   States   of   America "};
private   ImageIcon   flagImage[]=   new   ImageIcon[9];
private   String   flagDescription[]=new   String[9];

private   JComboBox   countryNameComboBox=new   JComboBox();
private   DescriptionPanel   descriptionPanel=new   DescriptionPanel();

public   ComCountry()
{
        flagImage[0]   =   new   ImageIcon( "images/ca.gif ");
                flagImage[1]   =   new   ImageIcon( "images/china.gif ");
                flagImage[2]   =   new   ImageIcon( "images/denmark.gif ");
                flagImage[3]   =   new   ImageIcon( "images/fr.gif ");
                flagImage[4]   =   new   ImageIcon( "images/germany.gif ");
                flagImage[5]   =   new   ImageIcon( "images/india.gif ");
                flagImage[6]   =   new   ImageIcon( "images/norway.gif ");
                flagImage[7]   =   new   ImageIcon( "images/uk.gif ");
                flagImage[8]   =   new   ImageIcon( "images/us.gif ");

                //   Set   text   description
                flagDescription[0]   =   "The   Maple   Leaf   flag   \n\n "   +
                "The   Canadian   National   Flag   was   adopted   by   the   Canadian   "   +
                "Parliament   on   October   22,   1964   and   was   proclaimed   into   law   "   +
                "by   Her   Majesty   Queen   Elizabeth   II   (the   Queen   of   Canada)   on   "   +
                "February   15,   1965.   The   Canadian   Flag   (colloquially   known   "   +
                "as   The   Maple   Leaf   Flag)   is   a   red   flag   of   the   proportions   "   +
                "two   by   length   and   one   by   width,   containing   in   its   centre   a   "   +