I am making a MDI application in java using netbeans. the issue is that i have two buttons: Add employee and search employee. When i click Add employee, the internal frame for add employee opens up in the desktop pane, and when i click search employee it gets behind the earlier frame and is not visible until i exit the first frame. I want that if desktop pane is not empty then earlier internal frame should be disposed on click of the other button. Plese help me out
This is the code: Here JP is variable name for desktop pane.
private void BAddEmpActionPerformed(java.awt.event.ActionEvent evt) {
o=new EntryEmp();
JP.add(o);
o.setVisible(true);
}
private void BSearchEmpActionPerformed(java.awt.event.ActionEvent evt) {
Employee_search ob1=new Employee_search();
JP.add(ob1);
ob1.setVisible(true);
}
After you've added the new
JInternalFrame
and made it visible callJInternalFrame#toFront