View Single Post
Join Date: Dec 2004
Posts: 4,245
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: 492
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

JPAnel need clean sweaping

 
0
  #1
Nov 19th, 2008
In the JFrame I have two components JMenuBar and JPanel. A selection in one of the options in menu bar change the content of panel as
  1. JMenuItem jmiAddEmployee = new JMenuItem("Add Employee");
  2. jmiAddEmployee.addActionListener(new ActionListener()
  3. {
  4. public void actionPerformed(ActionEvent ae)
  5. {
  6. mainPanel.removeAll();
  7. mainPanel.add(addEP);
  8. validate();
  9. }
  10. });
This will replace the content, unfortunately if the previous components in the old one been longer then the new ones I will get new components with bits of old where the content is shorter. Is there any solution to this problem or do I need to swap my JMenuBar+JPanel for JTabbedPane?
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