Professional Documents
Culture Documents
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Graphics;
public class heli extends JFrame {
public heli() {
setTitle("DrawArcs");
add(new ArcsPane());
}
/** Main method */
public static void main(String[] args) {
heli frame = new heli();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(1000, 1500);
frame.setVisible(true);
}
}
// The class for drawing arcs on a panel
class ArcsPane extends JPanel {
// Draw four blazes of a fan
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
int xCenter = getWidth() / 2;
int yCenter = getHeight() / 2;
int titikX[] =
{600,850,850,600};
//Background
g.setColor(Color.black);
g.drawPolygon(t, n, 7);
//Helikopter
g.setColor(Color.blue);
g.fillArc(100, 100, 600, 100, 0, 360);
g.setColor(Color.red);
g.fillArc(100, 100, 600, 100, 0, 50);
g.setColor(Color.red);
g.fillArc(100, 100, 600, 100, 70, 45);
g.setColor(Color.red);
g.fillArc(100, 100, 600, 100, 130, 45);
g.setColor(Color.red);
g.fillArc(100, 100, 600, 100, 210, 45);
g.setColor(Color.red);
g.fillArc(100, 100, 600, 100, 270, 45);
g.setColor(Color.black);
g.fillArc(370, 140, 50, 30, 0, 180);
g.setColor(Color.blue);
g.fillPolygon(titikX, titikY, titikX.length);
g.setColor(Color.red);
g.fillRoundRect(220, 550, 350 ,40 ,40,90);
g.setColor(Color.magenta);
g.fillOval(150, 200, 500, 400);
g.setColor(Color.red);
g.fillRoundRect(220, 600, 350 ,40 ,40,90);
g.setColor(Color.yellow);
}
}