试试
event.getComponent().repaint();

解决方案 »

  1.   

    在paintComponet中
    加一句super.paintComponent(g)试试我搞不懂你为什么要在paintComponet中用showMessageDialog
      

  2.   

    to:sxhv998(^_^)Dorian(^_^)
    to: shuneng()
       可是按你说的那种方法也还是没有反应啊!
      

  3.   

    你是想再弹个DIALOG出来吗?
    event.getComponent().paintComponent(event.getComponent().getGraphics());
      

  4.   

    原来是你的方法签名写错了paintComponet(Graphics g)
    应该是paintComponent(Graphics g)不过我还是搞不懂你为什么要在paintComponent(Graphics g)中弹出消息框
    这样会死循环的
    因为每次按确定后,消息框消失,窗体自动重绘,会再次弹出这个消息框的。
      

  5.   

    正如楼上所说,是错误paintComponent(Graphics g)处,修改后就好了。但,按确定后消息框上的内容都在panel上重绘了,
    这个怎么不让他重绘在panel上啊?