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);
}
});
*/
新闻热点
疑难解答