读书人

JAVA的心,该怎么处理

发布时间: 2012-01-13 22:43:30 作者: rapoo

JAVA的心

Java code
    public static void main(String[] args) throws Exception {        BufferedImage bi = new BufferedImage(500, 500, BufferedImage.TYPE_INT_RGB);        Graphics2D graphics = (Graphics2D) bi.getGraphics();        graphics.setColor(Color.WHITE);        graphics.fillRect(0, 0, 500, 500);        graphics.setColor(Color.RED);                for (int i = 0; i < 100000; i++) {            int r = (int) ((1 + Math.sin(i)) * 150);            int x = (int) (r * Math.cos(i) + 250);            int y = (int) (r * Math.sin(i) + 175);            Line2D point = new Line2D.Double(x, y, x, y);            graphics.draw(point);        }                        FileOutputStream fos = new FileOutputStream("c:\\test.jpg");        ImageIO.write(bi, "JPEG", fos);        fos.flush();        fos.close();    }


[解决办法]
然后可以结合那个透明的JFrame 搞个心满桌面飞
[解决办法]
有点像 苹果 ...
[解决办法]
Graphics2D graphics = (Graphics2D) bi.getGraphics();
=>
Graphics2D graphics = bi.createGraphics();

读书人网 >J2SE开发

热点推荐