paintComponent () never executes on a JFrame

前端 未结 1 913
长发绾君心
长发绾君心 2020-12-04 01:35
import javax.swing.SwingUtilities;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.BorderFactory;
import java.awt.Color;
import java.awt.Dim         


        
相关标签:
1条回答
  • 2020-12-04 01:44

    JFrame is not a JComponent, it doesn't have a paintComponent method you can override. Instead you could extend a JPanel and add it to the frame.

    0 讨论(0)
提交回复
热议问题