⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jtextarea3.java

📁 textarea使用说明
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class JTextArea3 implements ActionListener

{ JTextArea textarea=null;
  JButton b1,b2,b3;
  public JTextArea3()
{ JFrame f=new JFrame("jtextarea3");
  Container contentPane =f.getContentPane();
  contentPane.setLayout(new BorderLayout());
  textarea=new JTextArea(5,5);
  JScrollPane scrollPane=new  JScrollPane(textarea);
  JPanel panel=new JPanel();
  panel.setLayout(new GridLayout(1,3));
  b1=new JButton("copy");
  b1.addActionListener(this);
  b2=new JButton("copy");
  b2.addActionListener(this);
  b3=new JButton("cut");
  b3.addActionListener(this);
  panel.add(b1);
  panel.add(b2);
  panel.add(b3);
  contentPane.add(scrollPane,BorderLayout.CENTER);
  contentPane.add(panel,BorderLayout.SOUTH);
  f.pack();
  f.setVisible(true);
  f.addWindowListener(new WindowAdapter(){
 	public void windowClosing(WindowEvent e){
 		System.exit(0);
 	}});
  }
  
  public static void main(String args[])
  {
  	new JTextArea3();
  }
  public void actionPerformed(ActionEvent e)
  {if(e.getSource()==b1)
   textarea.copy();
   if (e.getSource()==b2)
   textarea.paste();
   if (e.getSource()==b3)
   textarea.cut();
  }
}	
	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -