Java TechnologyJava Tutorial Example of creating edit menu for Notepad by Online Tutorials Library July 22, 2022 84 Example of creating Edit menu for Notepad: import javax.swing.*; import java.awt.event.*; public class Notepad implements ActionListener{ JFrame f; JMenuBar mb; JMenu file,edit,help; JMenuItem cut,copy,paste,selectAll; JTextArea ta; Notepad(){ f=new JFrame(); cut=new JMenuItem(“cut”); copy=new JMenuItem(“copy”); paste=new JMenuItem(“paste”); selectAll=new JMenuItem(“selectAll”); cut.addActionListener(this); copy.addActionListener(this); paste.addActionListener(this); selectAll.addActionListener(this); mb=new JMenuBar(); mb.setBounds(5,5,400,40); file=new JMenu(“File”); edit=new JMenu(“Edit”); help=new JMenu(“Help”); edit.add(cut);edit.add(copy);edit.add(paste);edit.add(selectAll); mb.add(file);mb.add(edit);mb.add(help); ta=new JTextArea(); ta.setBounds(5,30,460,460); f.add(mb);f.add(ta); f.setLayout(null); f.setSize(500,500); f.setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getSource()==cut) ta.cut(); if(e.getSource()==paste) ta.paste(); if(e.getSource()==copy) ta.copy(); if(e.getSource()==selectAll) ta.selectAll(); } public static void main(String[] args) { new Notepad(); } } download this example Next TopicOpen Dialog Box creating edit menu for Notepad Share 0 FacebookTwitterPinterestEmail previous post DR. A.P.J ABDUL KALAM: Biography, Birthday, Born, Family, Education, Age, Marrriage, Wife, Childrens, quotes, books, photos, death, thoughts, Full form next post Exception Handling | Error Page in JSP You may also like Java Email Validation Java String charAt() method Java String toLowerCase() method Java Collections replaceAll() Method with Examples Java Interpreter Java SHA