Java puede ser trazada, no creo que un evento pequeño de Java
El poder de Java que es difícil de aprender
Pero podemos aprender especializados
La siguiente es una confesión de amor parcela
darle las chicas como ella
java.awt.Color importación;
java.awt.Graphics de importación;
java.awt.Image importación;
java.awt.Toolkit importación;
javax.swing.JFrame importación;
public class cardioide extiende JFrame {
private static int última WIDTH = 500;
estática final privado int HEIGHT = 500;
.. estática privada int window_width = Toolkit.getDefaultToolkit () getScreenSize () anchura;
. estática privada int window_height = Toolkit.getDefaultToolkit () getScreenSize () de altura.;
pública cardioide () {
super ( "Te quiero");
this.setBackground (Color.BLACK);
this.setLocation ((window_width-anchura) / 2, (window_height-ALTURA) / 2);
this.setSize (ancho, altura);
this.setLayout (getLayout ());
this.setVisible (true);
this.setDefaultCloseOperation (DISPOSE_ON_CLOSE);
}
Public void paint (Graphics g) {
double x, y, r;
Image image = this.createImage (anchura, altura);
Gráficos pic = image.getGraphics ();
for (int i = -2; i <90; i ++) {
for (int j = -2; j <90; j ++) {
r = Math.PI / 45 + Math.PI / 45 * i * (1-Math .sin (Math.PI / 45 j *)) * 18;
x = r * Math.cos (Math.PI / 45 j *) * Math.sin (Math.PI / 45 * i) + ancho / 2;
y = -r * Math.sin (Math.PI / 45 j *) + Altura / 3;
pic.setColor (Color.Magenta);
pic.fillOval ((int) x, (int) y, 2, 2);
}
G.drawImage (imagen, 0, 0, este);
}
}
Void Main (args String []) {public static
nueva cardioide ();
}
}