java 能在按钮JButton上面画图吗?下有代码

JButton btn = new JButton ("d:\1.jpg") ;
Graphics g = btn.getGraphics() ;
g.drawString("aaa",0,0) ;
this.add(btn) ;
JFrame frame = new JFrame () ;
frame.add(this) ;
frame.setSize(50,80) ;
frame.setVisible(true) ;

    目的是想着在JButton上面画图,然后用画笔在上面写字符串。
    至于为什么想着这样做,是想用用JButton里面的这个getgraphics的方法。
    不过按照上面这样做会报错,空指针的错误,这是为什么呢?不能这样做吗?

Graphics g = btn.getGraphics() ;
g.drawString("aaa",0,0) ;
getGraphics是相对于其他的“父容器”而言的,对于JButton是没有具体实现的。JButton也有这个方法,是因为JButton和JPanel具有相同顶级父类

错误也要贴出来。。。。。