I am trying to draw circles in java as shown in the GeoGebra image. There is one drawback: it won't let me put them together. Is there any way to put it like in the picture? Or am I putting some data wrong?
Attached image in geogebra and in java.
DRAWING CLASS
package ejemplografica;
import java.awt.Color;
import java.awt.Graphics;
public class Dibujo {
public static void lugar( Graphics g, int x,int y, int ancho, int alto, boolean t)
{
g.setColor(Color.GREEN);
g.fill3DRect(x, y, ancho, alto, t);
}
public static void aspersor(Graphics g, int x, int y, int ancho, int alto)
{
g.setColor(Color.BLUE);
g.fillOval(x, y, ancho, alto);
}
}
GRAPHIC FORM
private void CuadradoMouseClicked(java.awt.event.MouseEvent evt) {
Dibujo.lugar(mainPanel.getGraphics(), 100, 100, 100, 90, false);
Dibujo.aspersor(mainPanel.getGraphics(), 85, 85, 30, 30);
Dibujo.aspersor(mainPanel.getGraphics(), 85, 85+30, 30, 30);
Dibujo.aspersor(mainPanel.getGraphics(), 85, 85+30*2, 30, 30);
Dibujo.aspersor(mainPanel.getGraphics(), 85, 85+30*3, 30, 30);}
private void Cuadrado1ActionPerformed(java.awt.event.ActionEvent evt) {
repaint();
}