我在JFrame上制作项目并在JFrame上添加JPanel。当我使用paintcomponents函数时,它正在抛出NullPointerException
。我该怎么办?
@Override
public void paintComponents(Graphics g) {
// TODO Auto-generated method stub
super.paintComponents(g);
if(OSC==null)
{
createOSC();
}
g.drawImage(OSC, 0, 0, null);
if(dragging&&SHAPE_TOOLS.contains(currentTool))
{
g.setColor(currentColor);
putCurrentShape(g);
}
}