开发者

'image stretch' proxy for slow Swing component?

I have an application that displays plots using JFreeChart. As it happens, these plots are big and JFreeChart is not terribly fast, resulting in atrocious redra开发者_如何学Gow times, particularly when resizing the plot.

What I am after is a way to stretch an image representing the plot while resizing (a bit like the iPhone will present a screenshot of a stopped application while it gets started again), and perform a full redraw only after the user has released the mouse (i.e. once the final size of the plot is known).

The interaction features of the chart sould stay intact (when not resizing, obviously).

Is there a generic solution / Swing wrapper for this? (there is no reason why it should be JFreeChart-specific).

Cheers


No concrete answer, just a possible strategy

  • on starting the resize, paint the plot into a BufferedImage and show and resize that image instead of the plot
  • on stopping resize remove the image and show the plot again

in JDK 7, you can use a JLayer for the image/manipulation.

Edit

Alternatively (for JLayer), you could use a CardLayout: showing one card with the image while resizing and the another card with the plot while not resizing. SwingX ImagePainter can do the image scaling during the resize

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜