skip to main |
skip to sidebar
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code=”scroll” width=500 height=500>
</applet>
*/
public class scroll extends Applet implements AdjustmentListener
{
Scrollbar s1;
Scrollbar s2;
Scrollbar s3;
int x,y,z;
Color c;
public void init()
{
s1=new Scrollbar(Scrollbar.VERTICAL,0,1,0,255);
s2=new Scrollbar(Scrollbar.VERTICAL,0,1,0,255);
s3=new Scrollbar(Scrollbar.VERTICAL,0,1,0,255);
add(s1);
add(s2);
add(s3);
s1.addAdjustmentListener(this);
s2.addAdjustmentListener(this);
s3.addAdjustmentListener(this);
}
public void adjustmentValueChanged(AdjustmentEvent ae)
{
repaint();
}
public void paint(Graphics g)
{
x=s1.getValue();
y=s2.getValue();
z=s3.getValue();
c=new Color(x,y,z);
g.setColor(c);
setBackground(c);
}
}
OUTPUT
0 comments:
Post a Comment