/ Published in: Java
Ejercicio 1 Semana 1 - Curso Desarrollo de aplicaciones con Interfaz Gráfica, Manejo de Eventos, Clases y Objetos : Java.
www.senavirtual.edu.co
www.senavirtual.edu.co
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ejerciciorectangulo; import java.applet.Applet; import java.awt.*; import java.awt.event.*; /** * * @author Admin */ Scrollbar deslizador1,deslizador2,deslizador3; String etiq_desl1,etiq_desl2,etiq_desl3; int val_desl1 = 0; int val_desl2 = 0; int val_desl3 = 0; /** * Initialization method that will be called after the applet is loaded * into the browser. */ public void init() { add(deslizador1); add(deslizador2); add(deslizador3); deslizador1.addAdjustmentListener(this); deslizador2.addAdjustmentListener(this); deslizador3.addAdjustmentListener(this); } g.drawRect(0,0,150,300); g.fillRect(0,0,150,300); g.drawString(etiq_desl1,30,100); g.drawString(etiq_desl2,30,150); g.drawString(etiq_desl3,30,200); } val_desl1 = deslizador1.getValue(); val_desl2 = deslizador2.getValue(); val_desl3 = deslizador3.getValue(); etiq_desl1 = "deslizador 1 " + val_desl1; etiq_desl2 = "deslizador 2 " + val_desl2; etiq_desl3 = "deslizador 3 " + val_desl3; repaint(); } }