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