java - How to cancel a repaint of a JPanel? -


i know jpanel is, default, automatically double-buffered. however, have particularly time-intensive painting operation in panel, panel needs repainted when underlying data changes, rare. therefore, i'd reuse jpanel buffer instead of having clear after every call repaint().

i've manually implemented "dirty" flag on jpanel subclass, have no idea how cancel paint operation once it's been started. can't avoid call repaint in first place, since panel inside jscrollpane, being repainted every time it's resized (which does happen frequently), causes custom panel repainted.

is there way without manually buffering panel? if not, what's recommended method implementing manual buffer in conjunction jpanel?

i have particularly time-intensive painting operation .. needs repainted when underlying data changes, rare..

paint data bufferedimage, display in jlabel. call label.repaint() if changes. e.g. seen in this answer.

bonus showing image in label way gui preferred size, not need extend anything. perfect size frame or dialog displays it, call pack().


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -