Java实现动态雪花、心形图案、炫动字体完整版代码

Java实现桃花心形、动态雪花特效、炫动字体

package uu;

import java.awt.Color;
import java.awt.Graphics; 
import java.awt.Font;
import java.awt.Image;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.util.Random;

public class u{
    public static void main(String[] args)
    {
        JFrame frame=new JFrame();
        frame.setSize(800,600);
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(3);

        frame.setBackground(Color.BLACK);
        mypanel p=new mypanel();
        frame.add(p);
        frame.setVisible(true);
        Thread t=new Thread(p);
        t.start();
    }
}
class mypanel extends JPanel implements Runnable{
    private static final long serialVersionUID=1L;
    Font font=new Font("font",Font.BOLD,50);
    String colors[]={"red","yellow","blue"};
    Random random=new Random();
    int[] snowx=new int [600];
    int[] snowy=new int[600];
    int[] snowy1=new int[600];

    public mypanel()
    {
        
        for(int i=0;i<600;i++)
        {
            snowx[i]=this.random(800);
            snowy[i]=this.random(600);
        }
    }
    
    public void snowspaint(Graphics g)
    {
        g.setColor(Color.WHITE);
        for(int i=0;i<600;i++)
        {
            g.drawString("*",snowx[i],snowy[i]);
            for(int j=-1;j

你可能感兴趣的:(Java实现动态雪花、心形图案、炫动字体完整版代码)