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

GUI最很基础的有关问题

2012-01-09 
GUI最很基础的问题我想实现按某JButton后,程序读取若干个JTextField上的字串进行操作,我想这个应该可以用

GUI最很基础的问题
我想实现按某JButton后,程序读取若干个JTextField上的字串进行操作,我想这个应该可以用类内部的方法实现,应该怎样写呢?已经写的相关代码附在下面,编译的结果是“找不到符号”
        text[0]   =   new   JTextField(5);
        text[1]   =   new   JTextField(5);
                  text[2]   =   new   JTextField(5);

        ColourButton   =   new   JButton( "Show   Me   The   Colour ");
        ColourButton.addActionListener(
                      new   ActionListener()
        {        
        public   void   actionPerformed(   ActionEvent   e   )
        {      
        drawpic();
        }
        }
       
        );


        protected   void   drawpic()
        {
        Graphics   g;
        int   red,green,blue;
        red   =   Integer.parseInt(text[0].getText);
        green   =   Integer.parseInt(text[1].getText);
        blue   =   Integer.parseInt(text[2].getText);

        Color   c   =   new   Color(red,green,blue);
        drawpanel.paintComponent(g);
        g.setColor(c);
        g.fillrect(20,20,40,40);
        }


[解决办法]
建议放出所有代码..............
[解决办法]
是啊,
把你完整的代码贴出来,
别人也方便检查啊

热点排行