Swing - paintComponent method not being called

后端 未结 2 548
面向向阳花
面向向阳花 2020-12-21 00:42

i simply implemented class that inherits JPanel like below

public class Orpanel extends JPanel {

....
    @Override
    public void paintComponent(Graphics          


        
2条回答
  •  悲&欢浪女
    2020-12-21 01:05

    Sounds like you're just using the wrong methods. You should be doing this when adding a panel to a frame:

    frame.getContentPane().add(panel) ;
    

提交回复
热议问题