มาวาดรูปหัวใจกันเหอะ

​มาวาดรูปหัวใจกัน​เหอะ​

import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import javax.swing.*;
@SuppressWarnings ("serial")
public class Valentine extends JApplet
{
    int width = 400, height = 400;
    JPanel p2;
    boolean wait = false;
    public void init ()
    {
        p2 = new JPanel ();
        p2.setBackground (Color.black);
        p2.setPreferredSize (new Dimension (width, height));
        setContentPane (p2);
        this.setSize (width, height);
        new Thread (new MyThread ()).start ();
    }
    class MyThread implements Runnable
    {
        int x1, y1;
        double t;
        boolean die = false;
        MyThread ()
        {
            x1 = 0;
            y1 = 0;
        }
        public void run ()
        {
            Graphics g = p2.getGraphics ();
            while(true)
            {
                while (x1 < 100)
                {
                    x1++;
                    y1 = -(int) (Math.abs (x1) + Math.sqrt (10000 – Math.pow (x1, 2)));
                    g.setColor (Color.red);
                    g.fillOval (x1+200, y1+200, 2, 2);
                    g.fillOval (400 – x1-200, y1+200, 2, 2);
                    y1 = -(int) (Math.abs (x1) – Math.sqrt (10000 – Math.pow (x1, 2)));
                    g.fillOval (x1+200, y1+200, 2, 2);
                    g.fillOval (400 – x1-200, y1+200, 2, 2);
                    try
                    {
                        Thread.sleep (30);
                    }
                    catch (InterruptedException e)
                    {}
                }
                try
                {
                    Thread.sleep (1000);
                }
                catch (InterruptedException e)
                {
                }
                g.setColor (Color.black);
                g.fillRect (0, 0, width, height);
                x1 = 0;
                x1 = 0;
            }
        }
    }
}

5 thoughts on “มาวาดรูปหัวใจกันเหอะ

  1. รูปหัวใจอารายอยากเห็นง่า…แต่ไม่รู้เรื่องเรยย ฮ่าๆ
    ใช้โปรแกรมไรเหรอ เห็นใจคนที่ไม่ได้เรียนจาวาด้วยค๊า..

  2. Amberdigital Branch,Southern Stars Enterprises Co is specializing in the development and manufacturing of screen advertisings, digital sign, digital signages and LCDs. Established in 1996, we have explored and developed the international market with professionalism. We have built a widespread marketing network, and set up a capable management team dedicated to provide beyond-expectation services to our customers.

    amberdigital Contact Us
    Southern Stars Enterprises Co (Hong Kong Office)
    Add:3 Fl, No.2, Lane 2, Kam Tsin Tsuen, Sheung Shui, Hong Kong
    Tel:+852 2681 4099
    Fax:+852 2681 4586
    Southern Stars Enterprises Co (Shenzhen Office)
    Add:DE, 16/F, Building 2, Nanguo Tower, Sungang Road, Shenzhen, China
    Tel:+86 755 2592 9100
    Fax:+86 755 2592 7171
    E-mail:sstar@netvigator.com
    website:www.amberdigital.com.hk
    alibaba:amberdigital.en.alibaba.com[aggbg

  3. Hi,Do you need advertising displays, digital signages, advertising player and LCD displays? Please go Here:www.amberdigital.com.hk(Amberdigital).we have explored and developed the international market with professionalism. We have built a widespread marketing network, and set up a capable management team dedicated to provide beyond-expectation services to our customers.
    amberdigital Contact Us
    website:www.amberdigital.com.hk
    alibaba:amberdigital.en.alibaba.com[ghafbegfcjhejh]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s