![]() |
|
[Java] [Help] How to refresh a JPanel - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Java] [Help] How to refresh a JPanel (/showthread.php?tid=5040418) |
[Help] How to refresh a JPanel - N3ll - Oct 30, 2015 Hi, I have a JFrame, inside the JFrame I have 3 JPanel. I want to change the middle JPanel with a setter, but when I do myframe.setMidPanel(new JPanel()); I still see my old panel I tried stuff like remove/add/validate/revalidate/repaint but I probably did something wrong because it's not working My JPanel contains a JTable My code is something like Code mainFrame.setpMid(vc);edit: I solved my problem with this: Code mf.remove(mf.getpMid());* - mrschiz0ide - Oct 31, 2015 You can make a thread and in this thread you make a while loop that constantly checks whether the condition you set changes and when then does, it will update the panel :) * - matt - Nov 2, 2015 (Oct 31, 2015 04:30 AM)mrschiz0ide Wrote: You can make a thread and in this thread you make a while loop that constantly checks whether the condition you set changes and when then does, it will update the panel :) oh dear god no no. |