首页 > 学院 > 开发设计 > 正文

Frame和JFrame代码比较

2019-11-10 16:45:21
字体:
来源:转载
供稿:网友

Frame和JFrame代码比较:

**包

      Frame----import java.awt.*;

      JFrame----import javax.swing.*;

**JFrame多了一个对于窗体字段的定义但是没有TextArea

**JFrame要先对窗体字段进行赋值

                 设置右上旋钮的作用

**初始化方法的时候:

      按钮动作事件的处理:

/*but.addActionListener(new ActionListener(){

                 publicvoid actionPerformed(ActionEvent e){

                      JDialogdialog =new JDialog(thisFrame,"JDialog的对话框:");

                       dialog.setModalityType(JDialog.ModalityType.application_MODAL);

                      dialog.setLocation(thisFrame.getX() +50,thisFrame.getY()+90);

                      dialog.setSize(200,150);

                      dialog.add(new JLabel(tex.getText()+",zoa"));

                      dialog.setVisible(true);

                     

                 }

           });

*/

 

/*

but.addActionListener(new ActionListener(){

                 publicvoid actionPerformed(ActionEvent e){

                      ta.setText(tf.getText() +"爱你!");

                 }

           });

           this.addWindowListener(new WindowAdapter(){

                 publicvoid windowClosing(WindowEvent e){

                      System.exit(0);

                 }

           });

*/


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表