我有一个扩展JComponent的自定义组件,它覆盖了paintComponent(Graphicsg)方法,但是当我尝试将它添加到我的JPanel时,它不起作用,没有绘制任何东西。这是我的代码:publicclassSimpleComponentextendsJComponent{intx,y,width,height;publicSimpleComponent(intx,inty,intwidth,intheight){this.x=x;this.y=y;}@OverridepublicvoidpaintComponent(Graphicsg){Graphics2Dg2=(Grap