Codex

Dictionary

Jul 28th, 2011
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. /*
  2. It is your personal dictionary
  3. use it to store any word and search it any time
  4. Required classes for this porgram are
  5. Add     http://pastebin.com/hKsEwVEk
  6. Search  http://pastebin.com/pdsKvMgM
  7. */
  8. import java.awt.*;
  9. import java.awt.event.*;
  10. import javax.swing.*;
  11. class Dictionary extends JFrame implements ActionListener
  12. {
  13. JButton jb,jb2;
  14. Dictionary()
  15. {
  16. super("Dictionary");
  17. setLayout(new GridBagLayout());
  18. jb=new JButton("Add word and meaning ");
  19. jb.setActionCommand("add");
  20. jb.addActionListener(this);
  21. jb2=new JButton("Search");
  22. jb2.setActionCommand("Search");
  23. jb2.addActionListener(this);
  24. add(jb);
  25. add(jb2);
  26. setSize(400, 400);
  27. setVisible(true);
  28. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  29. }
  30. public void actionPerformed(ActionEvent ae)
  31. {
  32. if((ae.getActionCommand()).equals("add"))
  33. {
  34. setVisible(false);
  35. new Add();
  36. }
  37. else if((ae.getActionCommand()).equals("Search"))
  38. {
  39. setVisible(false);
  40. new Search();
  41. }
  42. }
  43. public static void main(String args[])
  44. {
  45. SwingUtilities.invokeLater(new Runnable() {
  46. public void run() {
  47. new Dictionary();
  48. }
  49. });
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment