2011-10-14 54 views
0

我有一個程序,右側有一個面板,其中包含經常更新和重新繪製(使用paintImediately())的BufferedImage,左側是一些按鈕和JTextAreas。通常,當BufferedImage被重新繪製時,左邊的按鈕會重新繪製一部分圖像,使其內容變得模糊。我怎樣才能防止這一點?在Swing中重繪文物

這裏是我打電話,做重繪的方法:

void paintPlot() { 
    plot.paintImmediately(0, 0, 1000, 1000); 
} 

我把它從一個單獨的線程,如果是相關的。

+1

你是否總是在事件分派線程上進行重新繪製? –

+1

爲了更快得到更好的幫助,請發佈[SSCCE](http://pscode.org/sscce.html)。 –

+1

@Fractaly小心地用paintImediately(),因爲你畫的是指定的Rectangle,更多http://download.oracle.com/javase/6/docs/api/javax/swing/JComponent.html#paintImmediately%28int,%20int ,%20int,%20int%29 – mKorbel

回答

0

它在評論中回答。我需要創建這個,所以我可以將線程標記爲關閉。