readding removed panel in jframe
Let me first of all explain me problem,
I have a jpanel pnlBttns in my frame in the first view, which has 2
buttons as you can see in the image.
When clicked on Edit Video, this jpanel is removed, and i add another
jpanel named editPanel to my frame, as shown in the image below,
Now, here's the problem,
When I click on the back button, I remove back the editPanel and show the
pnlBttns. But what my frame shows is as below, the two buttons are there
but with no text.
..
The problem is strange because when clicked again on edit video
button(though its empty), it takes me to editPanel, and shows all keys
fine and normal. So why is the pnlBttns not shown properly, its not
getting "repainted" properly.
Code,
To hide pnlBttns,
state = "edit";
frame.remove(pnlBttns);
frame.add(editPanel, BorderLayout.EAST);
frame.revalidate();
frame.repaint();
To show it again,
frame.remove(editPanel);
frame.add(pnlBttns);
frame.revalidate();
frame.repaint();
I have checked and am 100% sure, I am no where updating the text of the
two buttons.
What I guess is the problem, may be size of panel.
What you see in black is my video player, its size gets increased when
pnlBttns is removed, since editPanel is thinner, when added back,
mediaPlayer also overlaps a little with the pnlBttns. Can that be the
problem, still the text should have been there. How can i solve this
problem?
Thanks for your time and efforts.
No comments:
Post a Comment