//窗体居中
          Dimension us=frame.getSize(),
     them=Toolkit.getDefaultToolkit().getScreenSize();
     int newX=(them.width-us.width)/2;
     int newY=(them.height-us.height)/2;
     cp.setLocation(newX,newY);
     cp.setVisible(true);
     paintMessage="Window should now be visible";
          frame.show();

解决方案 »

  1.   

    //将cp该为frame ,忘改了
    //窗体居中
              Dimension us=frame.getSize(),
         them=Toolkit.getDefaultToolkit().getScreenSize();
         int newX=(them.width-us.width)/2;
         int newY=(them.height-us.height)/2;
         frame.setLocation(newX,newY);
         frame.setVisible(true);
         //paintMessage="Window should now be visible";
              frame.show();
      

  2.   

    要往窗体上加载图片的话,请使用JBuilder
      

  3.   

    在窗体上加一个jlabel,然后用seticon将图片加到label上。
      

  4.   

    看一下JB创建的代码就可以了!
    是application 中的代码!