PORTAFOLIO DE EVIDENCIAS

Slides:



Advertisements
Similar presentations
Programming and Problem Solving With Java Copyright 1999, James M. Slack Applets What is an Applet? Applet Parameters Graphics in Applets Other Applet.
Advertisements

Events CSC 171 FALL 2001 LECTURE 9. History: the ABC John Vincent Atanasoff, with John Berry, developed the machine we now call the ABC -- the.
June 1, 2000 Object Oriented Programming in Java (95-707) Advanced Topics 1 Lecture 9 Object Oriented Programming in Java Advanced Topics Abstract Windowing.
1 Simple Phone Applet Lab Mobile Phone Display Area Send, Menu and End Numbers 0-9 * and #
Mouse Events and Keyboard Events
Copyright 2008 by Pearson Education Building Java Programs Graphics Reading: Supplement 3G.
1 Review of applets & Computer Graphis GUILecture 6 Review of Applets & Compute Graphics GUI Overview  Introduction to Graphics. Applets: a quick review.
24-Jun-15 Simple Animation. 2 The bouncing ball The “bouncing ball” is to animation what “Hello world” is to programming With a single Thread, we can.
Model-View-Controller. Design Patterns The hard problem in O-O programming is deciding what objects to have, and what their responsibilities are Design.
Copyright 2006 by Pearson Education 1 Building Java Programs Supplement 3G: Graphics.
James Tam An introduction into HCI: Task-Centered System Design An Introduction To Graphical User Interfaces The event-driven model Building a simple.
Java GUI building with the AWT. 2 AWT (Abstract Window Toolkit) Present in all Java implementations Described in most Java textbooks Adequate for many.
Program Design With Methods And Graphics / Chapter 4 1 Abstract Window Toolkit.
Programming Task: Task 1 Controlled Assessment Practice.
CSTP WS00CS423 (cotter)1 Java Applets Objective: Learn how to develop Java programs that interact with users through a Web browser.
Applets CS 3331 Sections 3.3 & 4.7 of [Jia03].
Button 元件. public class ko12_1 extends Applet implements ActionListener { Label lb=new Label(" 輸入密碼 :"); TextField tf1=new TextField(25); Button bn=new.
© 2007 Lawrenceville Press Slide 1 Chapter 2 HTML An example HTML document Hello world!
Internet Software Development Applets Paul J Krause.
Java applet basics, loading & displaying images After this section, you should be able to : –Use the applet tag and applet parameters –Describe what a.
Java On The Web Session 15. Memory Upload JAVA Applets Colors Fonts Drawing Methods Posting your Applet.
Applets.
Java Software Solutions Lewis and Loftus Chapter 10 Copyright 1997 by John Lewis and William Loftus. All rights reserved. 1 Graphical User Interfaces --
Java Applet Presented by Fitsum Okubu. Introduction Introduction Graphics Graphics Methods and Variables Methods and Variables Events Events Decision.
Java GUI building with Swing. 2 AWT (Abstract Window Toolkit) Present in all Java implementations Described in (almost) every Java textbook Adequate for.
Abstract Window Toolkit (AWT) The Abstract Window Toolkit (AWT) supports Graphical User Interface (GUI) programming. AWT features include:  A rich set.
Cs884(Prasad)java12AWT1 Abstract Windowing Toolkit Support for Graphical User Interface (Event-driven programming)
Programming and Problem Solving With Java Copyright 1999, James M. Slack Graphics in Java Applications The Graphics Class The Canvas Class The MouseListener.
7/3/00SEM107- © Kamin & ReddyClass 11 - Events - 1 Class 11 - Events r A couple of odds & ends m Component sizes  switch statement r Event types r Catching.
Applet in Java Abhishek Singh. Advantage of Applet There are many advantages of applet. They are as follows : It works at client side so less response.
GUI 프로그래밍과 AWT(2) 컴퓨터 공학실험 (I) 인공지능 연구실. 2 AWT Event Model  Java 의 Event Model 1.Event : 사용자가 Program 에 가한 행동 2.Event Source : Event 가 일어난 근원 3.Event.
CPS Today’s topics Java Applications Graphics Upcoming Review for Midterm Exam Reading Great Ideas, Chapters 5.
12/5/00SEM107, Kamin & ReddyReview - 34 Events Event types Catching different event types Getting information from components and events Distinguishing.
Layout Managers Arranges and lays out the GUI components on a container.
Lec 16 Adding Mouse and KeyEvent handlers to an Applet Class.
Java Applet Basics (2). The Body Mass Index Calculator.
Animation To animate our programs, that is, to have real time interactions where objects move on the screen, we want to call repaint( ) every few milliseconds.
2/5/00SEM107 © Kamin & Reddy Review -1 Class 19 - Review r This lecture contains a selection of slides from previous lectures, giving the “high points”
Java Model-View-Controller. Design Patterns The hard problem in O-O programming is deciding what objects to have, and what their responsibilities are.
Applets. Internet/WWW How does it work? Internet/WWW.
1 Applications & Applets Standalone applications & Java applets Peter Mozelius DSV/UCSC.
1 A Simple Applet. 2 Applets and applications An applet is a Java program that runs on a web page Applets can be run within any modern browser To run.
CSI 3125, Preliminaries, page 1 Applet. CSI 3125, Preliminaries, page 2 Graphics Methods public abstract void drawString(String str, int x, int y): is.
1 Graphics, Fonts and Color Chapter 9. 2 What is in this chapter: l Graphics class and coordinates l graphics primitives (lines,rectangles,ovals and arcs)
CS102 Algorithms and Programming II1 A Simple Applet Program // Author: Ilyas Cicekli Date: October 9, 1997 // // A simple applet program which prints.
CSI 3125, Preliminaries, page 1 AWT Control. CSI 3125, Preliminaries, page 2 AWT Control The AWT supports the following types of controls: ■ Labels ■
PHY281 Scientific Java Programming ArraysSlide 1 Arrays In this section we will learn how about storing groups of related variables that share the same.
More OOP. Extending other’s classes extend Java platform classes, e.g. class Applet public class MyApplet extends Applet { public void init() { } public.
Laboratory Study November, Demonstrates Life Cycle of an Applet + Mouse Events + Scrolling.
Rina System development with Java Instructors: Rina Zviel-Girshin Lecture 10.
Lec 15 Writing an Applet Class. Agenda Writing an Applet class Java Graphics class.
1 CSC 551: Web Programming Spring 2004 Java Applets  Java vs. C++  instance vs. class variables, primitive vs. reference types, inheritance  graphical.
AGENDA FOR APRIL Calculator Phase 3 PowerPoint Presentation 2. Work on Calculator Project Phase 3 Do your best to exceed the expectations of this.
Unit-vi. Concepts of Applets, differences between applets and Applications Life cycle of an applet Types of applets, creating applets, passing parameters.
Modular Event Handling
Monday 26th May Java Lecture 10 Overview
Lecture 09 Applets.
INFSY 547: WEB-Based Technologies
Object Oriented Programming
Multimedia in Java Multimedia combines graphics, animation and sound
Tópicos avanzados de programación
TOPICOS AVANZADOS de programación
INSTITUTO TÉCNOLOGICO SUPERIOR DE LIBRES CARLA PATRICIA VIVANCO GARCÍA TOPICOS AVANZADOS DE PROGRAMACIÓN ELIZABETH DÍAZ OREA.
INSTITUTO TECNOLÓGICO SUPERIÓR DE LIBRES TÓPICOS AVANZADOS DE PROGRAMACIÓN ESMERALDA LIMÓN ESCUTIA ASESOR: ELIZABETH DÍAZ OREA PORTAFOLIO DE EVIDENCIAS.
Today’s topics Java Applications Upcoming Reading Graphics
Java Applets.
Objects At Their Best— Java's Abstract Window Toolkit
Applet in Java.
GUI building with the AWT
static public void graficar(
Presentation transcript:

PORTAFOLIO DE EVIDENCIAS MAGALY SALAZAR GARCIA TÓPICOS AVANZADOS DE PROGRAMACIÓN ELIZABETH DÍAZ OREA

INDICE GENERAL CUADRO DE COLORES HOLA COMO ESTAS? FIGURAS CALCULADORA KARDEX FIGURAS CON BOTONES PROGRAMA DE PULSA EL BOTON HOLA MUNDO

CUADRO DE COLORES CÓDIGO

¿HOLA COMO ESTAS ? CODIGO

F IGURAS CODIGO

FIGURAS CON BOTONES CODIGO

CALCULADORA CODIGO

KARDEX CODIGO

PULSA EL BOTON CODIGO

Hola mundo CODIGO

CUADRO DE COLORES INDICE import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.awt.color.*; public class cuadros extends Applet implements ActionListener { Button b; public void init() { b= new Button ("cuadro de colores"); b.addActionListener (this); add(b); } public void actionPerformed (ActionEvent e) { repaint (); public void paint (Graphics g) setBackground(Color.yellow); g.setColor(new Color((int)(Math.random()*255+1),(int)(Math.random()* 255+1),(int)(Math.random ()*255+1))); g.fillRect (60,110,110,100); INDICE

HOLA COMO ESTAS? INDICE import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class boton extends Applet implements ActionListener { TextField a,b,c; Button b1,b2; Label l; public void init() { l = new Label ("pulsa el boton "); a=new TextField (20); b1=new Button ("boton"); b1.addActionListener(this); add(l); add(a); add(b1); } public void actionPerformed (ActionEvent e ) { String letrero="l"; int aa=0; if (e.getSource()==b1); { aa=0; letrero="hola como estas"; l.setText(letrero); a.setText(aa + " "); INDICE

FIGURAS INDICE import java.applet.Applet; import java.applet.*; import java.awt.*; public class Figuras extends Applet { public void paint(Graphics g){ int[]x= {150,250,100}; int[]y= {120,200,200}; Polygon tri; tri = new Polygon (x,y,3); g.setColor(Color.blue); g.fillOval(500, 120,100, 100); g.setColor(Color.RED); g.fillPolygon(tri); g.setColor(Color.green); g.drawLine(450, 350, 500, 350); g.setColor(Color.ORANGE); g.fillRect(300, 150, 122, 60); g.setColor(Color.red); g.drawString("FIGURAS GEOMETRICAS", 250, 50); g.drawArc(50, 100, 150, 100, 80, 80); } INDICE

CALCULADORA INDICE add(a); add(l2); add(b); add(b1); add(c); } public void actionPerformed(ActionEvent e){ int num1= Integer.parseInt(a.getText()); int num2= Integer.parseInt(b.getText()); int num3; if(e.getSource()==b1){ num3=num1+num2; String num01= String.valueOf(num3); c.setText(num01); if(e.getSource()==b2){ num3=num1-num2; if(e.getSource()==b3){ num3=num1*num2; if(e.getSource()==b4){ num3=num1/num2; import java.applet.Applet; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class calculadora1 extends Applet implements ActionListener { TextField a, b, c; Button b1, b2, b3, b4; Label l,l2, l3; public void init() { l= new Label("Primer valor:"); a= new TextField(10); l2= new Label("Segundo valor:"); b= new TextField(10); b1= new Button("Suma"); b2= new Button("Resta"); b3= new Button("Multiplicación"); b4= new Button("Division"); l3=new Label("Resultado"); c= new TextField(10); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); add(l); INDICE

KARDEX import java.awt.*; import java.awt.event.*; import java.applet.Applet; import java.awt.Color.*; public class Cardex extends Applet implements ActionListener{ TextField t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14 ,t15,t16,t17,t18,t19,t20,t21,t22,t01,t02,tnom,tnum,tcar; Button b0,b1,b2,b3,b4,b5; Label l0,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16,l17,l18,l19,l20,l21,l22,l23,l2 4,l25,l26,l27,l28,l29,l30,l31,l32,l33,l34,l35,l36,l37,l38,l39,l40,l01,l02,lnom,ln um,lcar,lti,lesp; public void init() { lti=new Label("****kardex****"); lesp=new Label(" "); l0=new Label(" "); l2=new Label("*SEMESTRE: 1°*"); l3=new Label("**MATERIA**"); l4=new Label("**CALIFICACION**"); l01=new Label("**APROBADO**"); l02=new Label("**REPROBADO**"); l5=new Label("**Fund. De Programación**"); l6=new Label("**Calculo Diferencial**"); l7=new Label("**Matemáticas Discretas**"); l8=new Label("**Taller De Ética**"); l9=new Label("**Taller De Administracion**"); l10=new Label("**Fundamentos De Investigación**"); l11=new Label("");l12=new Label(" "); l13=new Label("SEMESTRE: 2°"); l14=new Label(" "); l15=new Label("**Programacion Orientada a Objetos**"); l16=new Label("**Calculo Integral**"); l17=new Label("**Contaduria Financiera**"); l18=new Label("**Quimica Gral**"); l19=new Label("**Algebra Lineal**"); l20=new Label("**Probabilidad y Estadistica**"); l21=new Label("");l22=new Label(""); l23=new Label("SEMESTRE: 3°"); l24=new Label(""); l25=new Label("**Estructura De Datos**"); l26=new Label("**Calculo Vectorial**"); l27=new Label("**Cultura Empresarial**"); l28=new Label("**Investigacion De Operaciones**"); l29=new Label("**Sistemas Operativos**"); l30=new Label("**Fisica General**"); l31=new Label("");l32=new Label(""); l34=new Label("PROMEDIO GENERAL:"); lnom=new Label("NOMBRE:"); lnum=new Label(" NUMERO DE CONTROL:"); lcar=new Label("CARRERA:"); t0= new TextField(7); t1= new TextField(7); t2= new TextField(7); t3= new TextField(7); t4= new TextField(7); t5= new TextField(7); t6= new TextField(7); t7= new TextField(7);

Panel P= new Panel(); P.setLayout(new GridLayout(36,2)); P.setBackground(Color.LIGHT_GRAY); add(P); P.add(lti); P.add(lesp); P.add(lnom); P.add(tnom); P.add(lnum); P.add(tnum); P.add(lcar); P.add(tcar); P.add(l0); P.add(l2); P.add(l3); P.add(l4); P.add(l5); P.add(t0); P.add(l6); P.add(t1); P.add(l7); P.add(t2); P.add(l8); P.add(t3); P.add(l9); P.add(t4); P.add(l10); P.add(t5); P.add(b0); P.add(t6); P.add(l11); P.add(l12); P.add(l14); P.add(l13); P.add(l15); P.add(t7); P.add(l16); P.add(t8); P.add(l17); P.add(t9); P.add(l18); P.add(t10); P.add(l19); P.add(t11); P.add(l20); P.add(t12); P.add(b1); P.add(t13); P.add(l21); P.add(l22); P.add(l24); P.add(l23); P.add(l25); P.add(t14); P.add(l26); P.add(t15); P.add(l27); P.add(t16); P.add(l28); P.add(t17); P.add(l29); P.add(t18); P.add(l30); P.add(t19); P.add(b2); P.add(t20); P.add(l31); P.add(l32); t8= new TextField(7); t9= new TextField(7); t10= new TextField(7); t11= new TextField(7); t12= new TextField(7); t13= new TextField(7); t14= new TextField(7); t15= new TextField(7); t16= new TextField(7); t17= new TextField(7); t18= new TextField(7); t19= new TextField(7); t20= new TextField(7); t21= new TextField(7); t22= new TextField(7); tnom=new TextField(7); tnum=new TextField(7); tcar=new TextField(7); t01= new TextField(-100); t01.setBackground(Color.blue); t02= new TextField(-100); t02.setBackground(Color.red); b0= new Button("PROMEDIO:)"); b2= new Button("PROMEDIO:)"); b3= new Button("PROMEDIO GENERAL:)"); b0.addActionListener(this); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this);

P.add(l34); P.add(t21); P.add(t01); P.add(l01); P.add(t02); P.add(l02); } public void actionPerformed(ActionEvent bot){ if(bot.getSource()==b0){ int a=Integer.parseInt(t0.getText()); int b=Integer.parseInt(t1.getText()); int c=Integer.parseInt(t2.getText()); int d=Integer.parseInt(t3.getText()); int e=Integer.parseInt(t4.getText()); int f=Integer.parseInt(t5.getText()); int g=(a+b+c+d+e+f)/6; if(g>=70){ t6.setBackground(Color.red); t6.setText(g+""); else{ t6.setBackground(Color.blue); if(bot.getSource()==b1){ int h=Integer.parseInt(t7.getText()); int i=Integer.parseInt(t8.getText()); int j=Integer.parseInt(t9.getText()); int k=Integer.parseInt(t10.getText()); int l=Integer.parseInt(t11.getText()); int m=Integer.parseInt(t12.getText()); int n=(h+i+j+k+l+m)/6; if(n>=70){ t13.setBackground(Color.red); t13.setText(n+""); } else{ t13.setBackground(Color.blue); if(bot.getSource()==b2){ int o=Integer.parseInt(t14.getText()); int p=Integer.parseInt(t15.getText()); int q=Integer.parseInt(t16.getText()); int r=Integer.parseInt(t17.getText()); int s=Integer.parseInt(t18.getText()); int t=Integer.parseInt(t19.getText()); int u=(o+p+q+r+s+t)/6; if(u>=70){ t20.setBackground(Color.red); t20.setText(u+""); t20.setText(u+""); } int v = Integer.parseInt(t6.getText()); int w=Integer.parseInt(t13.getText()); int x=Integer.parseInt(t20.getText()); int y=(v+w+x)/3; if(y>=70){ t21.setBackground(Color.blue); t21.setText(y+""); tnom.setBackground(Color.lightGray); tnum.setBackground(Color.lightGray); tcar.setBackground(Color.lightGray);

else{ t21.setBackground(Color.RED); t21.setText(y+""); tnom.setBackground(Color.lightGray); tnum.setBackground(Color.lightGray); tcar.setBackground(Color.lightGray); } public void paint(Graphics g){ setBackground(Color. BLACK); import java.awt.*; import java.awt.event.*; import java.applet.Applet; import java.awt.Color.*; public class Cardex extends Applet implements ActionListener{ TextField t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14 ,t15,t16,t17,t18,t19,t20,t21,t22,t01,t02,tnom,tnum,tcar; Button b0,b1,b2,b3,b4,b5; Label l0,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16,l17,l18,l19,l20,l21,l22,l23,l2 4,l25, l26,l27,l28,l29,l30,l31,l32,l33,l34,l35,l36,l37,l38,l39,l40,l01,l02,lnom,lnum,lc ar,lti,lesp; public void init() { lti=new Label("****kardex****"); lesp=new Label(" "); l0=new Label(" "); l2=new Label("*SEMESTRE: 1°*"); l3=new Label("**MATERIA**"); l4=new Label("**CALIFICACION**"); l01=new Label("**APROBADO**"); l02=new Label("**REPROBADO**"); l5=new Label("**Fund. De Programación**"); l6=new Label("**Calculo Diferencial**"); l7=new Label("**Matemáticas Discretas**"); l8=new Label("**Taller De Ética**"); l9=new Label("**Taller De Administracion**"); l10=new Label("**Fundamentos De Investigación**"); l11=new Label("");l12=new Label(" "); l13=new Label("**SEMESTRE: 2°**"); l14=new Label(" "); l15=new Label("**Programacion Orientada a Objetos**"); l16=new Label("**Calculo Integral**"); l17=new Label("**Contaduria Financiera**"); l18=new Label("**Quimica Gral**"); l19=new Label("**Algebra Lineal**"); l20=new Label("**Probabilidad y Estadistica**"); l21=new Label("");l22=new Label(""); l23=new Label("**SEMESTRE: 3°**"); l24=new Label(""); l25=new Label("**Estructura De Datos**"); l26=new Label("**Calculo Vectorial**"); l27=new Label("**Cultura Empresarial**"); l28=new Label("**Investigacion De Operaciones**"); l29=new Label("**Sistemas Operativos**"); l30=new Label("**Fisica General**"); l31=new Label("");l32=new Label(""); l34=new Label("PROMEDIO GENERAL:"); lnom=new Label("NOMBRE:"); lnum=new Label(" NUMERO DE CONTROL:"); lcar=new Label("CARRERA:"); t0= new TextField(7); t1= new TextField(7); t2= new TextField(7); t3= new TextField(7); t4= new TextField(7); t5= new TextField(7); t6= new TextField(7); t7= new TextField(7); t8= new TextField(7); t9= new TextField(7); t10= new TextField(7); t11= new TextField(7); t12= new TextField(7); t13= new TextField(7); t14= new TextField(7); t15= new TextField(7); t16= new TextField(7); t17= new TextField(7); t18= new TextField(7); t19= new TextField(7); t20= new TextField(7); t21= new TextField(7); t22= new TextField(7); tnom=new TextField(7); tnum=new TextField(7); tcar=new TextField(7);

public void actionPerformed(ActionEvent bot){ if(bot.getSource()==b0){ int a=Integer.parseInt(t0.getText()); int b=Integer.parseInt(t1.getText()); int c=Integer.parseInt(t2.getText()); int d=Integer.parseInt(t3.getText()); int e=Integer.parseInt(t4.getText()); int f=Integer.parseInt(t5.getText()); int g=(a+b+c+d+e+f)/6; if(g>=70){ t6.setBackground(Color.red); t6.setText(g+""); } else{ t6.setBackground(Color.blue); if(bot.getSource()==b1){ int h=Integer.parseInt(t7.getText()); int i=Integer.parseInt(t8.getText()); int j=Integer.parseInt(t9.getText()); int k=Integer.parseInt(t10.getText()); int l=Integer.parseInt(t11.getText()); int m=Integer.parseInt(t12.getText()); int n=(h+i+j+k+l+m)/6; if(n>=70){ t13.setBackground(Color.red); t13.setText(n+""); t13.setBackground(Color.blue); if(bot.getSource()==b2){ int o=Integer.parseInt(t14.getText()); int p=Integer.parseInt(t15.getText()); int q=Integer.parseInt(t16.getText()); int r=Integer.parseInt(t17.getText()); int s=Integer.parseInt(t18.getText()); int t=Integer.parseInt(t19.getText()); int u=(o+p+q+r+s+t)/6; if(u>=70){ t20.setBackground(Color.red); t20.setText(u+""); t01= new TextField(-100); t01.setBackground(Color.blue); t02= new TextField(-100); t02.setBackground(Color.red); b0= new Button("PROMEDIO:)"); b1= new Button("PROMEDIO:)"); b2= new Button("PROMEDIO:)"); b3= new Button("PROMEDIO GENERAL:)"); b0.addActionListener(this); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); Panel P= new Panel(); P.setLayout(new GridLayout(36,2)); P.setBackground(Color.BLUE); add(P); P.add(lti); P.add(lesp); P.add(lnom); P.add(tnom); P.add(lnum); P.add(tnum); P.add(lcar); P.add(tcar); P.add(l0); P.add(l2); P.add(l3); P.add(l4); P.add(l5); P.add(t0); P.add(l6); P.add(t1); P.add(l7); P.add(t2); P.add(l8); P.add(t3); P.add(l9); P.add(t4); P.add(l10); P.add(t5); P.add(b0); P.add(t6); P.add(l11); P.add(l12); P.add(l14); P.add(l13); P.add(l15); P.add(t7); P.add(l16); P.add(t8); P.add(l17); P.add(t9); P.add(l18); P.add(t10); P.add(l19); P.add(t11); P.add(l20); P.add(t12); P.add(b1); P.add(t13); P.add(l21); P.add(l22); P.add(l24); P.add(l23); P.add(l25); P.add(t14); P.add(l26); P.add(t15); P.add(l27); P.add(t16); P.add(l28); P.add(t17); P.add(l29); P.add(t18); P.add(l30); P.add(t19); P.add(b2); P.add(t20); P.add(l31); P.add(l32); P.add(l34); P.add(t21); P.add(t01); P.add(l01); P.add(t02); P.add(l02); }

INDICE int v = Integer.parseInt(t6.getText()); int w=Integer.parseInt(t13.getText()); int x=Integer.parseInt(t20.getText()); int y=(v+w+x)/3; if(y>=70){ t21.setBackground(Color.blue); t21.setText(y+""); tnom.setBackground(Color.RED); tnum.setBackground(Color.RED); tcar.setBackground(Color.RED); } else{ t21.setBackground(Color.RED); public void paint(Graphics g){ setBackground(Color.RED); INDICE

FIGURAS CON BOTONES INDICE } if(e.getSource()==d){ op =4; public void paint(Graphics g){ switch (op){ case 1: g.setColor(Color.BLUE); g.drawLine(550, 350, 650, 350); break; case 2: int []x={150,250,100 }; int []y={120,200,200}; Polygon tra; tra = new Polygon (x,y,3); g.setColor(Color.MAGENTA); g.fillPolygon(tra); case 3: g.setColor(Color.BLACK); g.fillRect(100,100,100,100); case 4: g.setColor(Color.ORANGE); g.fillOval(200, 300,100,100); import java.applet.Applet; import java.awt.*; import java.applet.Applet.*; import java.awt.event.*; import java.awt.Color.*; public class Figuras extends Applet implements ActionListener { Button a,b,c,d; static int op; public void init() { a=new Button("Linea"); b=new Button("Triángulo"); c=new Button("Cuadrado"); d=new Button("Circulo"); a.addActionListener(this); b.addActionListener(this); c.addActionListener(this); d.addActionListener(this); add(a); add(b); add(c); add(d); } public void actionPerformed(ActionEvent e) { repaint(); if(e.getSource()==a){ op=1; if(e.getSource()==b){ op =2; if(e.getSource()==c){ op=3; INDICE

PULSA EL BOTON INDICE } if(e.getSource()==c){ op=3; if(e.getSource()==d){ op =4; public void paint(Graphics g){ switch (op){ case 1: g.setColor(Color.BLUE); g.drawLine(550, 350, 650, 350); break; case 2: int []x={150,250,100 }; int []y={120,200,200}; Polygon tra; tra = new Polygon (x,y,3); g.setColor(Color.MAGENTA); g.fillPolygon(tra); case 3: g.setColor(Color.BLACK); g.fillRect(100,100,100,100); case 4: g.setColor(Color.ORANGE); g.fillOval(200, 300,100,100); import java.applet.Applet; import java.awt.*; import java.applet.Applet.*; import java.awt.event.*; import java.awt.Color.*; public class Figuras extends Applet implements ActionListener { Button a,b,c,d; static int op; public void init() { a=new Button("Linea"); b=new Button("Triángulo"); c=new Button("Cuadrado"); d=new Button("Circulo"); a.addActionListener(this); b.addActionListener(this); c.addActionListener(this); d.addActionListener(this); add(a); add(b); add(c); add(d); } public void actionPerformed(ActionEvent e) { repaint(); if(e.getSource()==a){ op=1; if(e.getSource()==b){ op =2; INDICE

HOLA MUNDO? import java.applet.Applet;import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.applet.*; public class boton1 extends Applet implements ActionListener { TextField a,b,c; Button b1,b2; Label l,lb; public void init() { l=new Label("Pulsa botón"); lb=new Label(""); b1=new Button("Botón"); b1.addActionListener(this); add(l); add(b1); add(lb); } public void actionPerformed(ActionEvent e) { String letrero="Miguel"; int r=0; if(e.getSource()==b1){ r=0; letrero="¡Hola mundo! "; lb.setText(letrero); a.setText(r + " "); INDICE