如何創建BufferedImage。在BufferedImage上繪製圖像並顯示該圖像?如何繪製緩衝圖像,然後將緩衝圖像繪製到JFrame? [Java的1.7 NoLibs-的Eclipse];
例子:
BufferedImage screen = new BufferedImage(200, 200,
BufferedImage.TYPE_BYTE_INDEXED);
Graphics2D graphic = screen.createGraphics();
graphic.drawImage(sprite.Coalblock, 0, 0, screen.getHeight, screen.getWidth, null);
g2d.dispose();
要做到這一點爲什麼:
所以我可以創建一個系統,我的屏幕可以調整所有的屏幕尺寸。通過更改所有圖像顯示的圖像大小。
圖像必須是可控的,可以實現並顯示在屏幕上。任何可靠的系統來做到這一點?
不,一個?這很難過 – 2014-12-05 16:55:16
只有27分鐘。您在JFrame內繪製一個JPanel。您不直接繪製到JFrame。 – 2014-12-05 16:59:24
對不起,我不認爲你理解。但感謝您的建議。我可以顯示圖像。但是,這是通過緩衝圖像>屏幕。我希望它像:緩衝圖像>緩衝圖像>屏幕 – 2014-12-05 17:01:23