I must have a lot of panels in my application.All main panels must be shown in same position.
When I click one button, reletad panel will be displayed with its components.
These panels also consist of panels,Jlabels,JButtons…….
To achieve this I have content panel in main frame.All other main panels will be added content panel according to clicked button.
I generated Java Panel by clicking New->Matisse->Panel(ResultBuilderPanel).Then I added my matisse components to panel.
Now My aim is to call this panel from JFrame when button is clicked.
I do not want to use Cardlayout.Because I do not prefer that there would be
so much code of lines in MAIN GUI
To do this I instantiate a global variable of ResultBuilderPanel in MainGuı.
Then I placed this piece of code in Mouseclicked event
private void RBButtonMouseClicked(java.awt.event.MouseEvent evt) {
resultBuilderPanel = new ResultBuilderPanel();
resultBuilderPanel.setVisible(true);
contentPanel.add(resultBuilderPanel);
directoryLabel.setText(directoryLabel.getText() + “Result Browser”);
pack();
}
But When I clicked related button panel is not shown.
Can anyone help me?