当前位置: 代码迷 >> J2SE >> JAVA的心,该怎么处理
  详细解决方案

JAVA的心,该怎么处理

热度:66   发布时间:2016-04-24 12:23:56.0
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();
  相关解决方案