Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- It is your personal dictionary
- use it to store any word and search it any time
- Required classes for this porgram are
- Add http://pastebin.com/hKsEwVEk
- Search http://pastebin.com/pdsKvMgM
- */
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- class Dictionary extends JFrame implements ActionListener
- {
- JButton jb,jb2;
- Dictionary()
- {
- super("Dictionary");
- setLayout(new GridBagLayout());
- jb=new JButton("Add word and meaning ");
- jb.setActionCommand("add");
- jb.addActionListener(this);
- jb2=new JButton("Search");
- jb2.setActionCommand("Search");
- jb2.addActionListener(this);
- add(jb);
- add(jb2);
- setSize(400, 400);
- setVisible(true);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- public void actionPerformed(ActionEvent ae)
- {
- if((ae.getActionCommand()).equals("add"))
- {
- setVisible(false);
- new Add();
- }
- else if((ae.getActionCommand()).equals("Search"))
- {
- setVisible(false);
- new Search();
- }
- }
- public static void main(String args[])
- {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- new Dictionary();
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment