0% found this document useful (0 votes)
19 views5 pages

Package Contoh1

Uploaded by

hnr.uninstall
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views5 pages

Package Contoh1

Uploaded by

hnr.uninstall
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

package contoh1;

import java.applet.Applet;

import java.awt.Color;

import java.awt.Graphics;

/**

* @author Hilmi

*/

public class line extends Applet implements Runnable {

int x=30,y=30;

Thread j;

public void start(){

if (j==null) {

j = new Thread(this);

j.start();

public void run(){

for (int i = 0; i <= 300; i++) {

if (i <= 100) {

x++;

if (i>=100 && i<=200 ) {

y++;

}
if (i >200) {

x++;

repaint();

try {

Thread.sleep(70);

} catch (Exception e) {

public void paint( Graphics g) {

g.setColor(Color.red);

g.drawRect(x, y, 30, 30);

}
Sales
9%

10%

23% 59%

1st Qtr 2nd Qtr 3rd Qtr 4th Qtr

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

import java.applet.Applet;

import java.awt.Color;

import java.awt.Graphics;

/**

* @author Hilmi

*/

public class pertemuan3 extends Applet implements Runnable{

int x=0;

int y=0;
Thread j;

public void start(){

if (j == null) {

j = new Thread(this);

j.start();

public void run(){

for (int i = 0; i <= 50; i++) {

if (i<=90) {

x++;

// if (i >= 100 && i<=200) {

// y++;

// }

if (i <= 115) {

y++;

repaint();

try {

Thread.sleep(50);

} catch (Exception e) {

public void paint(Graphics g) {


// TODO start asynchronous download of heavy resources

g.setColor(Color.yellow);

//g.fillRect(x, y, 20, 20);

g.fillArc(40, 40, 80, 80, 90,x );

g.setColor(Color.red);

g.fillArc(40, 40, 80, 80, 115,y );

g.setColor(Color.blue);

g.fillArc(40, 40, 80, 80, 140,70 );

g.setColor(Color.pink);

g.fillArc(40, 40, 80, 80, 210,240 );

// TODO overwrite start(), stop() and destroy() methods

You might also like