求助java大神(java究竟怎么画图,初学者很疑惑)为什么我下面这个画不了,怎么改才能画呢?
importjava.awt.Color;importjava.awt.Graphics;importjava.awt.image.BufferedImage;impor...
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
public class showWIN extends JFrame{
private static final long serialVersionUID = 1L;
public static void main(String[] args) {
BufferedImage bi = new BufferedImage(120,120, BufferedImage.TYPE_INT_ARGB);
Graphics g = bi.createGraphics();
g = g.create(0, 0, 100, 100);
g.setColor(Color.BLACK);
JFrame frame = new JFrame("hello SWING");
frame.setResizable(false);
frame.setSize(500,500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//**********//
frame.paint(g);
//**********//
frame.setTitle("tu");
frame.setVisible(true);
}
} 展开
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
public class showWIN extends JFrame{
private static final long serialVersionUID = 1L;
public static void main(String[] args) {
BufferedImage bi = new BufferedImage(120,120, BufferedImage.TYPE_INT_ARGB);
Graphics g = bi.createGraphics();
g = g.create(0, 0, 100, 100);
g.setColor(Color.BLACK);
JFrame frame = new JFrame("hello SWING");
frame.setResizable(false);
frame.setSize(500,500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//**********//
frame.paint(g);
//**********//
frame.setTitle("tu");
frame.setVisible(true);
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询