문제

I have a JFrame with an image as background,called setUndecorated and setWindowOpaque method. When I open JFrame and then let computer sleep,but when computer wake up from sleep, the JFrame becomes white.

I guess it maybe repaint problem, but I can not solve this problem, would you please give me some suggestions?

도움이 되었습니까?

해결책

You can simply try repainting the component, that contains the image when your window (JFrame) recieves focus. That should fix the problem of repainting after "waking up" i guess.

Also you can try this:

frame.addWindowListener ( new WindowAdapter ()
{
    public void windowActivated ( WindowEvent e )
    {
        // Here repaint what you need
    }
} );
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top