📄 right.java
字号:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Right extends JFrame {
public Right(){
JButton b1=new JButton("sleep");
JButton b2=new JButton("Hello");
b1.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
try{
Thread.currentThread().sleep(5000);
}catch(Exception e){}
}
}
);
b2.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event)
{
System.out.println("hello world");
}
}
);
getContentPane().setLayout(new FlowLayout());
getContentPane().add(b1);
getContentPane().add(b2);
pack();
show();
}
public static void main(String[] args)
{
new Right();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -