JPanel gets paintComponent gets called when child is entered
问题 Some previous entries here address paintComponent() being called repeatedly, but the answers hinged on paintComponent itself calling repaint(). Using Nimbus L&F, if I subclass JPanel and add a JButton or JTextField, then my JPanel's paintComponent() method gets called whenever I enter or leave a child. In addition, if the JTextField gets focus, my panel's paintComponent() method gets called for every flash of the text field's position cursor. My paintComponent() method does nothing other than