📄 myframe1.java
字号:
import java.awt.*;
import java.awt.event.*;
public class MyFrame1 extends Frame
{
Button bt=new Button("exit");
Button bt1=new Button("really??");
public MyFrame1(String title)
{
super(title);
initComponent();
}
public void initComponent()
{
this.setSize(800,600);
this.setLocation(200,100);
this.setBackground(Color.orange);
this.setLayout(new FlowLayout());
this.add(bt);
this.add(bt1);
this.addWindowListener(new WindowListener()
{
public void windowActivated(WindowEvent e)
{
} //Invoked when the Window is set to be the active Window.
public void windowClosed(WindowEvent e)
{
} //Invoked when a window has been closed as the result of calling dispose on the window.
public void windowClosing(WindowEvent e)
{
System.exit(0);
} //Invoked when the user attempts to close the window from the window's system menu.
public void windowDeactivated(WindowEvent e)
{
} //Invoked when a Window is no longer the active Window.
public void windowDeiconified(WindowEvent e)
{
} //Invoked when a window is changed from a minimized to a normal state.
public void windowIconified(WindowEvent e)
{
} //Invoked when a window is changed from a normal to a minimized state.
public void windowOpened(WindowEvent e)
{
}
});
bt.addActionListener(new MyActionListener());
bt1.addActionListener(new MyActionListener());
}
public static void main(String args[])
{
MyFrame1 mf=new MyFrame1("hello");
mf.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -