View Single Post
Join Date: Dec 2004
Posts: 4,120
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 471
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: JPAnel need clean sweaping

 
0
  #7
Nov 19th, 2008
No change

OK, here is construction of the JFrame
  1. public void runBankSystem()
  2. {
  3. Dimension d = new Dimension(500, 500);
  4. setTitle("Bank Managment System");
  5. setSize(d);
  6. setLocation(rp.resultPosition(d));
  7. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  8. setMenuBar();
  9. setJMenuBar(jmb);
  10. getContentPane().add(mainPanel);
  11. setVisible(true);
  12. }
and here is JMenuBar to call the changes
  1. public void setMenuBar()
  2. {
  3. jmb = new JMenuBar();
  4. JMenu jmEmployee = new JMenu("Employee");
  5. JMenuItem jmiAddEmployee = new JMenuItem("Add Employee");
  6. jmiAddEmployee.addActionListener(new ActionListener()
  7. {
  8. public void actionPerformed(ActionEvent ae)
  9. {
  10. mainPanel.removeAll();
  11. mainPanel.add(addEP);
  12. validate();
  13. }
  14. });
  15. JMenuItem jmiEditEmployee = new JMenuItem("Edit Employee");
  16. jmiEditEmployee.addActionListener(new ActionListener()
  17. {
  18. public void actionPerformed(ActionEvent ae)
  19. {
  20. mainPanel.removeAll();
  21. mainPanel.add(editEP);
  22. validate();
  23. }
  24. });
  25. jmiEditEmployee.addActionListener(this);
  26. jmEmployee.add(jmiAddEmployee);
  27. jmEmployee.add(jmiEditEmployee);
  28. jmb.add(jmEmployee);
  29. JMenu jmClient = new JMenu("Client");
  30. JMenuItem jmiAllClients = new JMenuItem("All Customers");
  31. jmiAllClients.addActionListener(new ActionListener()
  32. {
  33. public void actionPerformed(ActionEvent ae)
  34. {
  35. mainPanel.removeAll();
  36. mainPanel.add(allCP);
  37. validate();
  38. }
  39. });
  40. jmiAllClients.addActionListener(this);
  41. jmClient.add(jmiAllClients);
  42. jmb.add(jmClient);
  43. JMenu jmLogout = new JMenu("Logout");
  44. jmLogout.addActionListener(this);
  45. jmb.add(jmLogout);
  46. }
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote