请教BufferedImage中的setColor问题。# Java - 爪哇娇娃
j*n
1 楼
程序如下,
我在paintComponent中对bImage:BufferedImage 设置颜色,但是无论设置成什么颜色,
画出来的都是白颜色。请高手点解。
import javax.swing.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
class Player extends JPanel {
Image bImage = null;
public Player() {
setSize(800, 600);
bImage = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB);
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
bImage.getGraphics().setColor(Color.RED);
bImage.ge
我在paintComponent中对bImage:BufferedImage 设置颜色,但是无论设置成什么颜色,
画出来的都是白颜色。请高手点解。
import javax.swing.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
class Player extends JPanel {
Image bImage = null;
public Player() {
setSize(800, 600);
bImage = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB);
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
bImage.getGraphics().setColor(Color.RED);
bImage.ge