Once a JPanel has been instantiated and added to a visible JFrame, how do I add a new JComponent to it and update the display to show said new JComponent?
Original Question:
How to add
JComponenttoJPanelafterJPanelhas been added to aJFrame. I think I may have to extendJPaneland possibly overridepaintComponent().
JPanel.add()should work fine. If the frame is already visible, then call:Also, depending on the size and layout you may need to repack the frame with
pack().It is easier if you can post SSCCE with your question.