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:

enter image description here 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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -