import java.awt.*; import java.awt.event.*; public class TekstiKlahvid extends Frame implements ActionListener{ TextArea ta=new TextArea(); Button loika=new Button("Lőika"); Button kopeeri=new Button("Kopeeri"); Button kleebi=new Button("Kleebi"); public TekstiKlahvid(){ add(ta, BorderLayout.CENTER); Panel nupupaneel=new Panel(new GridLayout(1, 3)); nupupaneel.add(loika); nupupaneel.add(kopeeri); nupupaneel.add(kleebi); add(nupupaneel, BorderLayout.NORTH); loika.addActionListener(this); kopeeri.addActionListener(this); kleebi.addActionListener(this); setSize(300, 300); setVisible(true); } public void actionPerformed(ActionEvent e){ try{ ta.requestFocus(); Robot r=new Robot(); r.keyPress(KeyEvent.VK_CONTROL); if(e.getSource()==loika){ r.keyPress(KeyEvent.VK_X); r.delay(100); r.keyRelease(KeyEvent.VK_X); } if(e.getSource()==kopeeri){ r.keyPress(KeyEvent.VK_C); r.delay(100); r.keyRelease(KeyEvent.VK_C); } if(e.getSource()==kleebi){ r.keyPress(KeyEvent.VK_V); r.delay(100); r.keyRelease(KeyEvent.VK_V); } r.keyRelease(KeyEvent.VK_CONTROL); }catch(Exception probleem){System.out.println(probleem); probleem.printStackTrace(); } } public static void main(String argumendid[]){ new TekstiKlahvid(); } }