首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

这段代码中的第33行为什么不起作用?该如何解决

2012-03-06 
这段代码中的第33行为什么不起作用?就是setTitle(Welcome )这一句为什么不显示呢~???//Tutorial2:Welco

这段代码中的第33行为什么不起作用?
就是

          setTitle(   "Welcome "   );  

这一句为什么不显示呢~???


//   Tutorial   2:   Welcome.java
//   This   application   welcomes   the   user   to   Java   programming.
import   java.awt.*;
import   javax.swing.*;

public   class   Welcome   extends   JFrame
{
      private   JLabel   textJLabel;         //   JLabel   that   displays   text
      private   JLabel   pictureJLabel;   //   JLabel   that   displays   an   image

      //   no-argument   constructor
      public   Welcome()
      {
            createUserInterface();
      }

      //   create   and   position   GUI   components;   register   event   handlers
      private   void   createUserInterface()
      {
            //   get   content   pane   and   set   layout   to   null
            Container   contentPane   =   getContentPane();
            contentPane.setLayout(   null   );
           
            //   set   up   textJLabel
            textJLabel   =   new   JLabel();
            contentPane.add(   textJLabel   );
           
            //   set   up   pictureJLabel
            pictureJLabel   =   new   JLabel();
            contentPane.add(   pictureJLabel   );

            //   set   properties   of   application 's   window
            setTitle(   "Welcome "   );  
            setSize(   100,   100   );       //   set   width   and   height   of   JFrame
            setVisible(   true   );         //   display   JFrame   on   screen

      }   //   end   method   createUserInterface

      //   main   method
      public   static   void   main(   String[]   args   )
      {
            Welcome   application   =   new   Welcome();
            application.setDefaultCloseOperation(   JFrame.EXIT_ON_CLOSE   );

      }   //   end   method   main

}   //   end   class   Welcome




[解决办法]
我运行的时候是起到作用了的,不知道你的是为什么了
[解决办法]
关注

[解决办法]
AWUSOFT(程序设计,一个字:爽!)
===
哪爽?

热点排行