Você está na página 1de 2

import java.awt.Color; import java.awt.Graphics; import javax.swing.

JFrame; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author jorge.lopez */ public class Explicacion extends JFrame implements Constante { public Explicacion() { setSize(W,H); setVisible(true); setBackground(Color.black); } public void paint( Graphics g) { g.fillRect(0, 0, W, H); g.setColor(Color.yellow); g.drawString("Bienvenido a la programacion en JAVA", 30, 60); g.setColor(Color.white); g.drawString("Bienvenido al modo grafico", 30, 80); g.setColor(Color.white); g.drawRect(POSX_ROBOT, POSY_ROBOT, TAM_ROBOT, TAM_ROBOT); g.setColor(Color.white); g.drawLine(POSX_ROBOT + OJO_IZQ_POSX, POSY_ROBOT + OJO_IZQ_POSY, POSX_RO BOT + OJO_IZQ_POSX, POSY_ROBOT + OJO_IZQ_POSY); g.drawLine(POSX_ROBOT + OJO_DER_POSX, POSY_ROBOT + OJO_DER_POSY, POSX_RO BOT + OJO_DER_POSX, POSY_ROBOT + OJO_DER_POSY); g.drawLine(POSX_ROBOT + BOCA_IZQ_POSX, POSY_ROBOT + BOCA_IZQ_POSY, POSX_ ROBOT + BOCA_DER_POSX, POSY_ROBOT + BOCA_DER_POSY); g.drawArc(W, W, W, W, W, W); } public static void main( String args[] ) { int valor = 5; int opcion = 3; if( args.length > 0 ) { opcion = Integer.parseInt(args[0]); valor = Integer.parseInt(args[1]); }

switch( opcion ) { case 1: for( int i = 0; i < 10; i++ ) { if( i == valor ) break; System.out.printf("break Contador = %2d\n", i); } break; case 2: for( int i = 0; i < 10; i++ ) { if( i == valor ) continue; System.out.printf("continue Contador = %2d\n", i); } break; case 3: Explicacion app = new Explicacion(); app.setDefaultCloseOperation(EXIT_ON_CLOSE); break; } } }

Você também pode gostar