Skip to content

notepad #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions college_programs/psrp/Notepadfjava
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import java.awt.Dialog;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class MenuBar implements ActionListener{
JMenu file,edit;
JMenuItem cut,copy,paste,Save;
JMenuBar b;
JFrame f;
JTextArea ta;
static Dialog d;
MenuBar(){
f = new JFrame();
d = new Dialog(f , "Dialog Example", true);
cut=new JMenuItem("cut");
copy=new JMenuItem("copy");
paste=new JMenuItem("paste");
Save = new JMenuItem("Save");
Save.addActionListener(this);
cut.addActionListener(this);
copy.addActionListener(this);
paste.addActionListener(this);
b=new JMenuBar();
file=new JMenu("File");
edit=new JMenu("Edit");
file.add(Save);
edit.add(cut);
edit.add(paste);
edit.add(copy);
b.add(file);
b.add(edit);
ta = new JTextArea();
ta.setBounds(5,5,360,320);
f.add(b);
f.add(ta);
f.setJMenuBar(b);
d.setLayout(null);
f.setSize(400,400);
f.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==cut)
ta.cut();
else if(e.getSource()==paste)
ta.paste();
else if(e.getSource()==copy)
ta.copy();

}

}
public class Menu{
public static void main(String args[]) {
new MenuBar();
}
}