MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
deryaaltuntas
Post subject: I can not call jpanel class from Jframe  PostPosted: Mar 27, 2011 - 06:56 PM



Joined: Mar 14, 2011
Posts: 34

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?
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits