Swing components painted over...

Hi!

I’m using the class FullScreenJFrame from the scroller-demo to draw my game graphics. I also have some JButtons in use. Those buttons are painted over each time I call the render()-method. I tried to call myButton.repaint() but this results in heavy flickering.
Any ideas welcome!

martin

it’s hard to tell from your description what the job of the render() function is. If its job is to paint the entire screen and it does not call the JFrame’s standard repaint() method, then render() probably paints over your buttons. If your design allows for it, I would suggest placing all your buttons into their own JPanel, and then use a Canvas to draw your game. You can add the JPanel and the Canvas to the FullScreenJFrame, placing them wherever you want. Note however that your render() method must now draw onto the canvas and not the FullScreenJFrame().