Removing a JPanel from a JFrame, so slow
问题 This is what the code looks like: class Main extends JFrame { public MyPanel panel; public Main() { //all the frame init stuff panel = new MyPanel(this); Panel badPanel = new Panel();//this makes the remove method go veryy slow //add(badPanel, BorderLayout.SOUTH);// JPanel goodPanel = new JPanel(); add(goodPanel, BorderLayout.SOUTH); // this fixes the slowness of the remove method in calculate() add(panel, BorderLayout.CENTER); } public static void main(String[] args) { SwingUtilities