Re: java gui is flashing

2012-08-03 Thread benjamin fuentes
I use Ryan solution too with image rendering instead of calling repaint. One remark : the Graphic class display looks better than the Graphic2D class. I have superposition and refreshing, and in my case i got this. Thanks Ryan ! Le dimanche 25 juillet 2010 18:22:45 UTC+2, Mate Toth a écrit : >

Re: java gui is flashing

2010-07-25 Thread Mate Toth
Thx guys! I used double-buffering like in Ryan's code and it worked like a charm! M On Jul 25, 4:01 am, Ryan Sattler wrote: > I've been working on a game with Clojure/Swing lately and the simplest > way to avoid flashing is to draw to a bufferedImage first, then draw > that bufferedImage all at

Re: java gui is flashing

2010-07-25 Thread Nurullah Akkaya
On Sun, Jul 25, 2010 at 12:55 PM, Ryan Twitchell wrote: > You'd be best served overriding the JPanel's paint or paintComponent > method (I'm fuzzy on the difference), and then calling repaint > periodically (at your desired frame rate).  IIRC, repaint is safe to > call from any thread, and it will

Re: java gui is flashing

2010-07-25 Thread Isak Hansen
On Sat, Jul 24, 2010 at 3:11 PM, Mate Toth wrote: > Hi, > > my problem is that during execution my presentation java applet is > flashing. There are many components which paint to a JPanel using it's > Graphics (.getGraphics). I think maybe the problem is that I don't > have any "paint everything

Re: java gui is flashing

2010-07-25 Thread Ryan Twitchell
HI, You'd be best served overriding the JPanel's paint or paintComponent method (I'm fuzzy on the difference), and then calling repaint periodically (at your desired frame rate). IIRC, repaint is safe to call from any thread, and it will cause the paint methods to be called in the swing thread.

Re: java gui is flashing

2010-07-25 Thread Ryan Sattler
I've been working on a game with Clojure/Swing lately and the simplest way to avoid flashing is to draw to a bufferedImage first, then draw that bufferedImage all at once. This means that parts of the screen that don't change won't be briefly overwritten by the background color, avoiding flashing.

Re: java gui is flashing

2010-07-24 Thread Brian Schlining
I see 2 things: 1) It's best to explicitly start your Swing UI on Swing's event dispatch thread. The java code to do this is: SwingUtilities.invokeLater(new Runnable() { public void run() { new App(); // OR whatever you're started UI code is }

Re: java gui is flashing

2010-07-24 Thread Nurullah Akkaya
It is probably happening because a bare bones JPanel is a white canvas every time swing paints it, it paints a white canvas than your routines paint over that giving you the flashing behavior, right way to paint on a JPanel is to extend it using proxy and overwrite paintComponent method, this is th

java gui is flashing

2010-07-24 Thread Mate Toth
Hi, my problem is that during execution my presentation java applet is flashing. There are many components which paint to a JPanel using it's Graphics (.getGraphics). I think maybe the problem is that I don't have any "paint everything now" routine..(I don't know which Java routine to use, how I h