example7_25.java.bak
来自「不错的教程 适合中高级人员的使用」· BAK 代码 · 共 43 行
BAK
43 行
import java.awt.*;import java.awt.event.*;
class MyFrame extends Frame implements WindowListener
{ TextArea text;
MyFrame(String s)
{ super(s);
setBounds(100,100,200,300);
setVisible(true);
text=new TextArea();
add(text,BorderLayout.CENTER);
addWindowListener(this);
validate();
}
public void windowActivated(WindowEvent e)
{ text.append("\n我被激活");
validate();
}
public void windowDeactivated(WindowEvent e)
{ text.append("\n我不是激活状态了");
setBounds(0,0,400,400); validate();
}
public void windowClosing(WindowEvent e)
{ text.append("\n窗口正在关闭呢"); dispose();
}
public void windowClosed(WindowEvent e)
{ System.out.println("程序结束运行");
System.exit(0);
}
public void windowIconified(WindowEvent e)
{ text.append("\n我图标化了");
}
public void windowDeiconified(WindowEvent e)
{ text.append("\n我撤消图标化");
setBounds(0,0,400,400);validate();
}
public void windowOpened(WindowEvent e){ }
}
class Example7_25
{ ublic static void main(String args[])
{ new MyFrame("窗口");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?