java - Stop flickering/repainting -
so have java.applet.applet embedded jframe. applet uses java.awt.canvas drawing. code quite lot me post , there no "small" examples here picture @ least:
ok in above, canvas being draw on applet. jtextarea @ bottom hidden when toggle-button pressed , shown when toggle-button not pressed.
however, every time show/hide textarea, applet/canvas flickers. jframe resized everytime textarea shown/hidden.
now small snippet have show/hide looks like:
public void setconsolevisible(boolean visible) { this.scrollpane.setvisible(visible); //show/hide jtextarea. frame.pack(); //pack jframe resize it. frame.setsize(frame.getwidth(), frame.getheight() + 1); //resize frame 1px. }
how can stop flickering when resizes , show/hide jtextarea? canvas/applet double buffered.
the area painting on might smaller visible area. garbage painted on causing flicker. why resize frame 1 pixel? try removing,
frame.setsize(frame.getwidth(), frame.getheight() + 1);
Comments
Post a Comment