Results 1 to 3 of 3
Thread: a jpanel within a jpanel
- 12-10-2011, 09:15 AM #1Member
- Join Date
- Dec 2011
- Rep Power
a jpanel within a jpanel
I have a desktop application project in which I added buttons with functionalities to it. So, they all are contained in a single JPanel, now whenever I push a certain, I have a further data to gather from the user, In that JPanel where the button is located, I have inserted another JPanel where I want my respective fields to be displayed according to the button I pressed in the main JPanel.....
Now, my problem is that I cannot get to display that inner JPanel that I have made separately as a class,
In my main JPanel where my buttons are located I have written an 'actionPerformed' function for that button so that I can add the respective new JPanel...
EditProfile editprofile = new EditProfile(); // editprofile is the JPanel I want to add in the main JPanel editprofile.setVisible(true); this.innerPanel.add(editprofile); // innerpanel is the panel where my respecitve panels that I want to add will be displayed this.innerPanel.validate(); this.innerPanel.repaint(); this.validate(); // this is the Panel where my buttons are located this.repaint();
Can someone help me what I am doing wrong here???
Thanks for the help.
Re: a jpanel within a jpanel
This is possibly a layout issue -- that you're adding the new component to a container whose layout doesn't play nice with adding things like this -- but it's difficult to tell based on what you've posted. Better to create a small compilable and runnable program that demonstrates your problem, an SSCCE, and posting it here.
- 12-10-2011, 03:46 PM #3
- By bikashlama in forum AWT / SwingReplies: 7Last Post: 12-09-2011, 04:47 AM
- By trishtren in forum AWT / SwingReplies: 7Last Post: 04-05-2011, 06:52 PM
- By Tanshaydar in forum AWT / SwingReplies: 4Last Post: 12-08-2010, 07:00 PM
- By k2k in forum AWT / SwingReplies: 3Last Post: 04-20-2009, 11:31 PM