AWT的GUI编程

博客指出用AWT做GUI编程简单,无需学太细,记住流程即可。介绍了一般GUI窗口为Frame,给出了使用AWT进行GUI编程的示例代码,包含布局方法、添加组件、监听器方法等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

   其实用AWT做GUI的编程很简单,觉得这一部分不必学的太细,虽然函数很多,但是需要记住的却没有多少!只要知道这个流程就可以了.

   一般一个GUI的窗口都是Frame.

// An example of GUI programming using AWT

class MyFrame extends Frame

{

    public Myframe()

    {  //deciding Layout method  ,default is BoarderLayout,and others:GridLayout CardLayout FlowLayout

       //add component here,like Button Panel Fieldtext

       //class MyActionListener implements ActionListener

         { public void actionPerformed(ActionEvent e)

           {......} 

         }

     //here is other Listener method

    //add MyactionListener to each component

}

public static void main(String [] args)

{   MyFrame myframe = new MyFrame();

   ....

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值