📄 ch9_27.java
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ch9_27 extends JFrame implements ActionListener
{
JTextArea jt1=null;
JButton b1,b2,b3;
public ch9_27()
{
setBounds(20,20,500,300);
getContentPane().setLayout(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String [] args)
{
ch9_27 f=new ch9_27();
f.getContentPane().setLayout(null);
f.jt1=new JTextArea();
f.jt1.setBounds(20,20,200,80);
f.b1=new JButton("copy");
f.b1.addActionListener(f);
f.b1.setBounds(20,110,80,30);
f.b2=new JButton("paste");
f.b2.addActionListener(f);
f.b2.setBounds(120,110,80,30);
f.b3=new JButton("cut");
f.b3.addActionListener(f);
f.b3.setBounds(220,110,80,30);
f.getContentPane().add(f.jt1);
f.getContentPane().add(f.b1);
f.getContentPane().add(f.b2);
f.getContentPane().add(f.b3);
f.show();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)
{
jt1.copy();
}
if(e.getSource()==b2)
{
jt1.paste();
}
if(e.getSource()==b3)
{
jt1.cut();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -