home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-12-14 | 1.4 KB | 55 lines |
- /*
- A basic extension of the java.applet.Applet class
- */
-
- import java.awt.*;
- import java.awt.event.*;
- import java.applet.*;
-
- public class testAdjustEvent extends Applet
- {
- void ScrollValueChanged( AdjustmentEvent event)
- {
- int intValue = scoreBar.getValue();
- String strValue = String.valueOf(intValue);
-
- txtScore.setText(strValue);
- }
-
- public void init()
- {
- super.init();
-
- setLayout(null);
- label1 = new Label("Score:", Label.RIGHT);
- label1.setBounds(36,36,60,21);
- add(label1);
- txtScore = new TextField();
- txtScore.setEditable(false);
- txtScore.setBounds(108,36,48,23);
- add(txtScore);
- scoreBar = new Scrollbar(Scrollbar.HORIZONTAL,0,10,0,100);
- scoreBar.setBounds(180,36,137,26);
- add(scoreBar);
- txtScore.setText(String.valueOf(scoreBar.getValue()));
-
- Adjustment1 lAdjustment = new Adjustment1();
- scoreBar.addAdjustmentListener(lAdjustment);
- }
-
-
- Label label1;
- TextField txtScore;
- Scrollbar scoreBar;
-
- class Adjustment1 implements AdjustmentListener
- {
- public void adjustmentValueChanged(AdjustmentEvent event)
- {
- Object object1 = event.getSource();
- if (object1==scoreBar)
- ScrollValueChanged(event);
- }
- }
- }
-