example7_26.java.bak
来自「不错的教程 适合中高级人员的使用」· BAK 代码 · 共 30 行
BAK
30 行
import java.awt.*;import java.awt.event.*;
class MyFrame extends Frame
{ TextArea text; Boy police;
MyFrame(String s)
{ super(s);
police=new Boy(this);
setBounds(100,100,200,300); setVisible(true);
text=new TextArea(); add(text,BorderLayout.CENTER);
addWindowListener(police); validate();
}
}
class Boy extends WindowAdapter
{ MyFrame f;
public Boy(MyFrame f)
{ this.f=f;
}
public void windowActivated(WindowEvent e)
{ f.text.append("\n我被激活");
}
public void windowClosing(WindowEvent e)
{ System.exit(0);
}
}
class Example15_6
{ public static void main(String args[])
{ new MyFrame("窗口");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?