CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Java and JSP (http://www.codingforums.com/forumdisplay.php?f=54)
-   -   how to display the applet (http://www.codingforums.com/showthread.php?t=148886)

malaya 09-15-2008 08:19 PM

how to display the applet
 
actually the result
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;

public class Steps extends Applet implements AdjustmentListener {

private Scrollbar steps;
private int count, numberOfSteps;

public void init() {
steps = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 100);
add(steps);
steps.addAdjustmentListener(this);
}
public void paint(Graphics g) {
int count = 0;


int x = 20;
int y = 20;
while (count < numberOfSteps) {
g.drawLine(x, y, x + 20, y);
g.drawLine(x + 20, y, x + 20, y + 20);

x = x + 20;
y = y + 20;
count++;
}
}

public void adjustmentValueChanged(AdjustmentEvent e) {
numberOfSteps = steps.getValue();
repaint();
}
}


how to do:confused:


All times are GMT +1. The time now is 12:01 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.