<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Albalba &#38; Rodri's Weblog</title>
	<atom:link href="http://albalba.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://albalba.wordpress.com</link>
	<description>EL BLOG PARA OCA</description>
	<lastBuildDate>Thu, 12 Jun 2008 09:37:28 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>es</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='albalba.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/41cac261efe6d043f664608bbf73dacd?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Albalba &#38; Rodri's Weblog</title>
		<link>http://albalba.wordpress.com</link>
	</image>
			<item>
		<title>Ultimo Episodio, El Juego</title>
		<link>http://albalba.wordpress.com/2008/06/05/ultimo-episodio-el-juego/</link>
		<comments>http://albalba.wordpress.com/2008/06/05/ultimo-episodio-el-juego/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 13:13:01 +0000</pubDate>
		<dc:creator>albalba</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Ahorcado]]></category>
		<category><![CDATA[alba]]></category>
		<category><![CDATA[Codigo Java del Ahorcado]]></category>
		<category><![CDATA[el ahorcado]]></category>
		<category><![CDATA[escuchadores]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Juego del ahorcado]]></category>
		<category><![CDATA[oca uc3m]]></category>
		<category><![CDATA[rodrigo]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://albalba.wordpress.com/?p=101</guid>
		<description><![CDATA[
Nuestro juego es el ahorcado. Decidimos hacer el ahorcado a raíz de la práctica 2, en el que nos pedían que hiciésemos uno según unas características determinadas, ese fue el que entregamos en la primera parte, pero después decidimos hacer un cambio radical. Cuando dimos swing y empezamos a aprender las interfaces gráficas, quisimos que [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=albalba.wordpress.com&blog=2928136&post=101&subd=albalba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal" style="margin:0;"><strong></strong></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Nuestro juego es el ahorcado. Decidimos hacer el ahorcado a raíz de la práctica 2, en el que nos pedían que hiciésemos uno según unas características determinadas, ese fue el que entregamos en la primera parte, pero después decidimos hacer un cambio radical. Cuando dimos swing y empezamos a aprender las interfaces gráficas, quisimos que el juego fuese totalmente diferente a lo que era, así que lo modificamos muchas veces, quedando como resultado esto:</span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><strong><span style="font-family:Wingdings;"></span></strong><strong><span style="text-decoration:underline;"><span><span style="font-family:Times New Roman;">PANTALLA INICIAL</span></span></span></strong></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;">
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/06/aho1.jpg"><img class="alignnone size-medium wp-image-102" src="http://albalba.files.wordpress.com/2008/06/aho1.jpg?w=163&#038;h=300" alt="" width="163" height="300" /></a> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Al ejecutar el juego, se <strong>inicia una pantalla con la imagen de Simpson.jpg</strong> (un ImageIcon). Sobre la imagen hay <strong>4 botones</strong> <strong>JButton</strong>:</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 27pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span>- <strong>Créditos</strong>, se muestran los créditos del juego. </span><span lang="ES">En el escuchador del <span> </span>FrameAhorcado hay un</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 27pt;"><span lang="ES"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span> </span>If( evento= =&#8221;CREDITOS&#8221;)</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 27pt;"><span lang="ES"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span> </span>{</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 27pt;"><span lang="ES"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span> </span>(Llamamos a la clase que se encarga de eso)</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 27pt;"><span lang="ES"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span> </span>}</span></span></span></p>
<p class="MsoNormal" style="margin:0 0.9pt 0 35.4pt;"><span lang="ES"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span> </span>Para que en el FrameAhorcado salga otra ventanita aparte,no hemos utilizado un <span> </span>Frame, sino que hemos creado unas clases internas que heredan de JDialog. El <span> </span>JDialog puede recibir como argumento un JFrame, entonces, en las clases de <span> </span>Instrucciones y Créditos, tenemos un método que se encarga de devolvernos un <span> </span>JFrame con un JPanel ya relleno con los elementos que queremos mostrar. El constructor de la clase Creditos, se encarga de leer desde un fichero externo el texto que presentaremos como créditos. Para salir tenemos que dar al botón Aceptar o pinchar el aspa. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-9pt;margin:0 0 0 45pt;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-9pt;margin:0 0 0 45pt;"><span lang="ES"><span style="font-size:16pt;"><span style="font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/06/cerditos.jpg"></a></span></span></span></p>
<p class="MsoNormal" style="text-indent:-9pt;margin:0 0 0 45pt;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> <span><span style="font-size:16pt;"><span style="font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/06/cerditos.jpg"></a><a href="http://albalba.files.wordpress.com/2008/06/cerditos1.jpg"><img class="alignnone size-full wp-image-104" src="http://albalba.files.wordpress.com/2008/06/cerditos1.jpg?w=500&#038;h=169" alt="" width="500" height="169" /></a></span></span></span></span></span></p>
<p class="MsoNormal" style="text-indent:-9pt;margin:0 0 0 36pt;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">- <strong>Instrucciones</strong>, la explicación de cómo jugar. Escribimos en un fichero las instrucciones que más tarde queremos que se vean cuando pulsemos este botón mediante la clase Instrucciones. Funciona igual que la clase anterior pero con diferente dimensión y texto. Para salir hay que pinchar en Aceptar o en el aspa.</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span><span style="font-size:small;font-family:Times New Roman;"> <a href="http://albalba.files.wordpress.com/2008/06/instrucciones.jpg"><img class="alignnone size-full wp-image-105" src="http://albalba.files.wordpress.com/2008/06/instrucciones.jpg?w=500&#038;h=203" alt="" width="500" height="203" /></a></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span><span style="font-size:16pt;"><span style="font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/06/cerditos.jpg"></a><a href="http://albalba.files.wordpress.com/2008/06/cerditos1.jpg"></a></span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 27pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span>- <strong>Opciones</strong>, aparece una ventana pequeña la cual hemos impedido que se pueda <span> </span>maximizar (con setResizable()) para evitar que se pierda el orden y la buena apariencia.También hemos bloqueado la opción de cerrar del aspa con <span> </span></span><span lang="ES">frame.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHIN<span> </span>G_ON_CLOSE); así, la única manera de cerrar esta ventana, es pulsar el botón <span> </span></span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 35.4pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="ES">Aceptar. Lo hemos hecho así para confirmar las opciones de configuración, de lo contrario, nos quedaríamos con la configuración por defecto y no con la que el usuario desea.</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 27pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="ES"><span> </span></span><span>En la ventana se muestra los elementos en el siguiente orden:</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 27pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 106.8pt;"><span style="font-family:Symbol;"><span><span style="font-size:small;">·</span><span> </span></span></span><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Una <strong>ventana desplegable</strong>, JComboBox, con diferentes temas a elegir para la palabra secreta. Los temas son: arte, ciencia, deportes, música, personajes, tecnología, programación y otros. De estos se puede marcar uno. Al abrir la ventana, por defecto se marca el tema de arte en la ventana desplegable.</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 88.8pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 106.8pt;"><span style="font-family:Symbol;"><span><span style="font-size:small;">·</span><span> </span></span></span><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Se puede elegir <strong>la dificultad</strong> entre fácil, normal, difícil y muy difícil. Se elige gracias a 4 JRadioButton mostrando cuatro pequeños círculos, en los que si pinchas se rellenan con un punto negro. Sólo se puede elegir uno de los 4, por esta razón elegimos JRadioButton.</span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 106.8pt;"><span style="font-family:Symbol;"><span><span style="font-size:small;">·</span><span> </span></span></span><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Un botón Aceptar</span></strong><span>, JButton, para aceptar las opciones establecidas por el jugador.</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 88.8pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 88.8pt;"><span><span><span style="font-size:small;font-family:Times New Roman;"> <span style="font-size:16pt;"><span style="font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/06/cerditos.jpg"></a><a href="http://albalba.files.wordpress.com/2008/06/cerditos1.jpg"></a><a href="http://albalba.files.wordpress.com/2008/06/opciones.jpg"><img class="alignnone size-full wp-image-106" src="http://albalba.files.wordpress.com/2008/06/opciones.jpg?w=200&#038;h=200" alt="" width="200" height="200" /></a></span></span></span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 88.8pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 88.8pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-9pt;margin:0 0 0 36pt;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">- <strong>Iniciar Juego</strong>, si es pulsado inicia el juego. Al pulsarlo aparece una ventana que se compone de varias partes. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 30pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 30pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 30pt;"><strong><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="margin:0 0 0 30pt;"><strong><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="margin:0 0 0 30pt;"><span style="font-size:small;"><strong><span style="font-family:Wingdings;"><span>à</span></span></strong><strong><span style="text-decoration:underline;"><span><span style="font-family:Times New Roman;"> PANTALLA DEL JUEGO</span></span></span></strong></span></p>
<p class="MsoNormal" style="margin:0 0 0 30pt;"><strong><span style="text-decoration:underline;"><span><span style="text-decoration:none;"><span style="font-size:small;font-family:Times New Roman;"> </span></span></span></span></strong></p>
<p class="MsoNormal" style="margin:0 0 0 30pt;"><strong></strong></p>
<p class="MsoNormal" style="margin:0 0 0 30pt;"><span><span style="font-size:small;font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/06/juego.jpg"><img class="alignnone size-full wp-image-107" src="http://albalba.files.wordpress.com/2008/06/juego.jpg?w=400&#038;h=732" alt="" width="400" height="732" /></a> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Estas partes están <strong>colocadas en columna obedeciendo el orden establecido por un GridLayout</strong>: </span></span></span></p>
<p class="MsoNormal" style="text-indent:-30pt;margin:0 0 0 30pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-6pt;margin:0 0 0 36pt;"><span style="font-family:Times New Roman;"><span><span><span style="font-size:small;">-</span><span> </span></span></span><span><span style="font-size:small;"><span> </span><span> </span>Lo siguiente se logra gracias a la clase PanelBorder, el cual coloca un borde en un panel. En letras rojas colocamos <strong>JUGUEMOS!! </strong>poniendo un nombre al borde del panel. Mientras que el borde no se aprecia porque está en negro y no se distingue con el fondo.</span></span></span></p>
<p class="MsoNormal" style="text-indent:-6pt;margin:0 0 0 36pt;"><span style="font-family:Times New Roman;"><span><span><span style="font-size:small;">-</span><span> </span></span></span><span><span style="font-size:small;"><span> </span>Botón denominado <strong>Menú principal</strong>, con el que puedes volver a la pantalla inicial. En el momento que el jugador esté situado en dicha ventana, se puede realizar todas las operaciones que ésta ofrece.</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 30pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-9pt;margin:0 0 0 36pt;"><span style="font-family:Times New Roman;"><span><span><span style="font-size:small;">-</span><span> </span></span></span><span><span style="font-size:small;"><span> </span>La imagen del <strong>muñeco ahorcado</strong> es un ImageIcon. El juego está compuesto de 7 imágenes del ahorcado del clásico juego, y una carita feliz en el caso de haber ganado la partida. La primera vez que aparece, cuando empieza la partida, tan solo sale la soga. Si se pulsa una letra errónea, que no se encuentra en la palabra secreta, sale también la cabeza, después la cabeza y el cuerpo,… y así sucesivamente hasta completar todo su cuerpo, momento en el que se habrá perdido la partida.</span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-9pt;margin:0 0 0 36pt;"><span style="font-family:Times New Roman;"><span><span><span style="font-size:small;">-</span><span> </span></span></span><span><span style="font-size:small;"><span> </span>Un JLabel en el que se encuentra la <strong>palabra a adivinar oculta entre los asteriscos</strong>. Los asteriscos son de color blanco para que resalten sobre el fondo negro.</span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-9pt;margin:0 0 0 36pt;"><span style="font-family:Times New Roman;"><span><span><span style="font-size:small;">-</span><span> </span></span></span><span><span style="font-size:small;"><span> </span>Un JButton en amarillo, al pulsarlo se invoca a un objeto de la clase CompletaPalabra, apareciendo una ventana donde puedes introducir la palabra que se cree que es la correcta. Esta ventana sólo se cierra en el momento que se pulsa el enter. En el botón se puede ver escrito <strong>¿sabes la solución? </strong>En la pantalla de juego, cuando se pulsa cualquier botón, esta pantalla se coloca sobre la de la palabra secreta, sólo está debajo cuando se inicia una nueva partida. De momento, está opción está deshabilitada. </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 27pt;">
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"><span style="font-size:16pt;"><span style="font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/06/cerditos.jpg"></a><a href="http://albalba.files.wordpress.com/2008/06/cerditos1.jpg"></a><a href="http://albalba.files.wordpress.com/2008/06/opciones.jpg"></a><a href="http://albalba.files.wordpress.com/2008/06/juego2.jpg"><img class="alignnone size-full wp-image-108" src="http://albalba.files.wordpress.com/2008/06/juego2.jpg?w=400&#038;h=732" alt="" width="400" height="732" /></a></span></span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span> </span></p>
<p class="MsoNormal" style="text-indent:-9pt;margin:0 0 0 36pt;"><span style="font-family:Times New Roman;"><span><span><span style="font-size:small;">-</span><span> </span></span></span><span><span style="font-size:small;">Un <strong>borde</strong> blanco que rodea el teclado en el que aparece escrito <strong>TECLADO</strong> en letras blancas. Esto se consigue gracias al PanelBorder.</span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-9pt;margin:0 0 0 36pt;"><span style="font-family:Times New Roman;"><span><span><span style="font-size:small;">-</span><span> </span></span></span><span><span style="font-size:small;"><span> </span>Y un array con <strong>30 JButton</strong>, con las 27 letras del abecedario en color rojo, un botón para iniciar una nueva partida, otro para resolver la palabra y otro para salir del juego, éstos tres últimos en color negro. Hemos utilizado el constructor del JButton que permite poner un nombre y un icono al botón. Para que las letras se quedasen centradas, se empleó el método de JButton setHorizontalAlligment(int posicion);</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 12pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 12pt;"><span style="font-size:small;"><span style="font-family:Wingdings;"><span>à</span></span><span><span style="font-family:Times New Roman;"> <strong><span style="text-decoration:underline;">INTENTOS</span></strong></span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 12pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">En cada intento puedes pulsar una tecla correspondiente a una letra.</span></span></span></p>
<p class="MsoNormal" style="text-indent:0;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span><span><span style="font-size:small;">-</span><span> </span></span></span><span><span style="font-size:small;"><span> </span>Si la letra se encuentra en la palabra, la letra se descubre en la palabra de <span> </span><span> </span>asteriscos en su correspondiente posición, actualizando el JLabel que la <span> </span>contiene. </span></span></span></p>
<p class="MsoNormal" style="text-indent:0;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span><span><span style="font-size:small;">-</span><span> </span></span></span><span><span style="font-size:small;"><span> </span>Si la letra no está en la palabra secreta, pierdes una oportunidad, y la imagen del <span> </span>ahorcado se actualiza, colocándose un miembro más del cuerpo del pobre <span> </span>muñeco. </span></span></span></p>
<p class="MsoNormal" style="text-indent:0;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span><span><span style="font-size:small;">-</span><span> </span></span></span><span><span style="font-size:small;"><span> </span>Si pulsas una letra ya pulsada anteriormente, no hace nada. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Pulsando el botón <strong>Nueva Partida</strong>, comienzas una nueva partida del ahorcado directamente preparado para jugar, sin aparecer en la pantalla de bienvenida. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Con el botón <strong>Resolver</strong>, se desvela la palabra secreta hayamos perdido, ganado o nos encontremos en medio de la partida, pero en el momento en que la pulses, ya no podrás seguir jugando con esa palabra, el jugador estará obligado a pulsar Nueva Partida si quiere seguir jugando.</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Con el botón <strong>Salir</strong>, se sale de la aplicación cerrándose la ventana del ahorcado.</span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><strong><span style="font-family:Wingdings;"><span>à</span></span></strong><strong><span style="text-decoration:underline;"><span><span style="font-family:Times New Roman;"> PERDER Y GANAR</span></span></span></strong></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Se pierde</span></strong><span> si en los 6 intentos no has conseguido resolver la palabra. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">De forma contraria, <strong>se gana</strong> si consigues resolver la palabra antes de que el muñeco aparezca totalmente ahorcado, es decir, antes de que se acaben los 6 intentos. Entonces, en el lugar en el que está la imagen del ahorcado, se verá una carita contenta en señal de felicitación. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;">
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/06/ganar.jpg"><img class="alignnone size-full wp-image-109" src="http://albalba.files.wordpress.com/2008/06/ganar.jpg?w=400&#038;h=732" alt="" width="400" height="732" /></a> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Se puede jugar tantas partidas como se quiera pulsando el botón correspondiente a Nueva Partida.</span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><strong><span style="font-family:Wingdings;"><span>à</span></span></strong><strong><span style="text-decoration:underline;"><span><span style="font-family:Times New Roman;"> IMPLEMENTACIÓN DEL JUEGO. CLASES.</span></span></span></strong></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span>El juego se compone de las siguientes clases:</span><strong> </strong></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><span style="font-size:small;"><strong><span lang="ES">Compara, </span></strong><span lang="ES">implementa el algoritmo del ahorcado. En él situamos los arrays de String para cada tema con las posibles palabras a jugar, busca una palabra aleatoria, se escoge la palabra según la dificultad elegida (la dificultad se escoge acorde al número de letras de la palabra), oculta la palabra entre asteriscos,…<strong></strong></span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 12pt;"><strong><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><span style="font-size:small;"><strong><span lang="ES">FrameAhorcado, </span></strong><span lang="ES">es la clase principal, la que engloba todas las clases. Se encarga de la interfaz gráfica de usuario. Contiene 4 clases internas: FrameConfigura, FrameCreditos, FrameInstrucciones y Configuracion. Las tres primeras llaman al método getFrame() con un objeto correspondiente a la clase Configura, Creditos e Instrucciones, respectivamente. Los 3 heredan de JDialog. Mientras que la clase interna Configuración, contiene a su vez otra clase interna llamada EscuchaBoton. <strong></strong></span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="ES"><span> </span></span></strong><span lang="ES">Se colocaron clases internas con el fin de reutilizar el código y buscando lo más cómodo y fácil para programar. Si no hubiésemos hecho clases internas, sería más complicado de programar. Al estar interna, podemos acceder directamente a los atributos y métodos de la clase que la contiene. En cambio, desde una clase externa, no se puede acceder a los atributos de otra clase de una forma tan sencilla, ya que siguiendo la encapsulación, están con el modificador de acceso private.</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 12pt;"><strong><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><span style="font-size:small;"><strong><span lang="ES">Instrucciones, </span></strong><span lang="ES">lee desde un fichero externo (llamado instrucciones.txt), las instrucciones que aparecen al pulsar dicho botón de la pantalla inicial. <strong></strong></span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 12pt;"><strong><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><span style="font-size:small;"><strong><span lang="ES">Configuración, </span></strong><span lang="ES">se encarga de sacar las opciones de la pantalla de bienvenida, puedes elegir la dificultad y el tema del que tratará la palabra a adivinar. <strong></strong></span></span></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><span style="font-size:small;"><strong><span lang="ES">ComparaPalabra,</span></strong><span lang="ES"> hace que aparezca una ventana para resolver la palabra oculta. Si la palabra es correcta, se gana automáticamente. De lo contrario, se pierde. En estos momentos se encuentra deshabilitado.<strong></strong></span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 12pt;"><strong><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><span style="font-size:small;"><strong><span lang="ES">Créditos, </span></strong><span lang="ES">la clase créditos es para mostrar lo que está escrito en el fichero créditos.txt. Al igual que la clase Instrucciones carga lo que vamos a mostrar por pantalla desde un fichero externo.<strong></strong></span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 12pt;"><strong><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><span style="font-size:small;"><strong><span lang="ES">PanelBorder, </span></strong><span lang="ES">hereda de TitledBorder. </span><span>En esta clase hemos construido <strong>6 <span> </span>constructores</strong> diferentes para formar bordes según lo deseado en cada momento.</span><strong></strong></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 18pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 66pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">1.</span><span> </span></span></span><span style="font-size:small;"><span>Constructor en el que s</span><span lang="ES">e introduce el color del borde y la palabra que aparecerá en dicho borde. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 48pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 48pt;"><span style="color:#ff0000;"><span style="font-size:small;">public PanelBorder(Color color,String nombre)<br />
<span> </span>{<br />
<span> </span>super(new LineBorder(color),nombre);<br />
<span> </span>}</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 48pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 66pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">2.</span><span> </span></span></span><span lang="ES"><span style="font-size:small;">Constructor al que se le pasa el color del borde, la anchura del borde y la palabra en él escrita.</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 48pt;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 48pt;"><span lang="ES"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></span><span style="color:#ff0000;"><span style="font-size:small;">public PanelBorder(Color color,int ancho,String nombre)<span> </span><br />
<span> </span>{<br />
<span> </span><span> </span>super(new LineBorder(color, ancho),nombre);<span> </span><br />
<span> </span>}</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 48pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 66pt;"><span style="font-family:Times New Roman;"><span><span><span style="font-size:small;">3.</span><span> </span></span></span><span><span style="font-size:small;">Constructor al que se le pasa el color del borde, el color de la letra de la palabra que se va a escribir en el borde y la palabra que desees colocar. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 45pt;"><span lang="ES"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></span></p>
<div class="MsoNormal" style="margin:0 0 0 45pt;"><span style="color:#ff0000;"><span style="font-size:small;">public PanelBorder(Color color,Color letra,String nombre )<br />
<span> </span>{<br />
<span> </span>super(new LineBorder(color),nombre);<br />
<span> </span>super.setTitleColor(letra);<br />
<span> </span>}</span></span></div>
<div><span style="color:#ff0000;"><span style="font-size:small;"> </span></span></div>
<div><span style="color:#ff0000;"><span style="font-size:small;"> </span></span></div>
<div><span style="color:#ff0000;"><span style="font-size:small;"> </span></span></div>
<p><span style="color:#ff0000;"><span style="font-size:small;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 48pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 66pt;"><span style="font-family:Times New Roman;"><span><span><span style="font-size:small;">4.</span><span> </span></span></span><span><span style="font-size:small;">Constructor al que se le añade a los anteriores el ancho del borde.</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 48pt;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 45pt;"><span lang="ES"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></span><span style="color:#ff0000;"><span style="font-size:small;">public PanelBorder(Color color,Color letra,int ancho,String nombre)<br />
<span> </span>{<br />
<span> </span>super(new LineBorder(color, ancho),nombre);<br />
<span> </span>super.setTitleColor(letra);<br />
<span> </span><br />
<span> </span>}</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 45pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 66pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">5.</span><span> </span></span></span><span lang="ES"><span style="font-size:small;">Constructor al que se le pasa lo del anterior pero en lugar de meter el color de la letra, pasamos la posición.</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 48pt;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 45pt;"><span style="color:#ff0000;"><span style="font-size:small;">public PanelBorder(Color color,int ancho,int posicion,String nombre)<span> </span><br />
<span> </span>{<br />
<span> </span>super(new LineBorder(color, ancho),nombre);<br />
<span> </span>super.setTitleJustification(posicion);<br />
<span> </span>}</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 45pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 66pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">6.</span><span> </span></span></span><span lang="ES"><span style="font-size:small;">Y el último al que se le pasan todos los parámetros anteriores.</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 48pt;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 45pt;"><span style="color:#ff0000;"><span style="font-size:small;">public PanelBorder(Color color,Color letra,int ancho,int posicion,String nombre)<br />
<span> </span>{<br />
<span> </span>super(new LineBorder(color,ancho),nombre);<br />
<span> </span>super.setTitleColor(letra);<br />
<span> </span>super.setTitleJustification(posicion);<br />
<span> </span>}</span></span></p>
<p class="MsoNormal" style="margin:0 0 0 45pt;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span style="font-size:small;"><span style="font-family:Wingdings;"><span>à</span></span><span lang="ES"><span style="font-family:Times New Roman;"> <span style="text-decoration:underline;">RELACIÓN ENTRE CLASES.</span></span></span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Ver en página anexa por favor.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span style="font-size:small;"><span style="font-family:Wingdings;"><span>à</span></span><span lang="ES"><span style="font-family:Times New Roman;"> <span style="text-decoration:underline;">VENTANA DE COMANDOS.</span></span></span></span></strong></p>
<p class="MsoNormal" style="margin:0 0 0 12pt;"><strong><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Para compilar el juego las imágenes (Homer y Bart, los distintas fases del ahorcado, las diferentes imágenes para los botones y la carita contenta) y los códigos fuente deben estar en la misma carpeta. Así, una vez que se haya colocado en la ventana de comandos la ruta en la que se encuentra dicha carpeta, escribir la sentencia javac *.java para compilar todos los archivos de una sola vez. Entonces, se formarán los .class de cada una de las clases. Una vez hecho esto, se ejecuta mediante java FrameAhorcado. Después, aparecerá la ventana principal del juego en el lado izquierdo de la pantalla del ordenador, y todo preparado para comenzar la partida.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><strong><span style="font-family:Wingdings;"><span>à</span></span></strong><strong><span lang="EN-GB"><span style="font-family:Times New Roman;"> <span style="text-decoration:underline;">PROBLEMAS.</span></span></span></strong></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><span lang="ES"><span style="font-size:small;">Tuvimos muchos problemas sobre todo al comenzar desde cero.</span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><strong><span lang="ES"><span style="font-size:small;">Los Escuchadores.</span></span></strong></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><span style="font-size:small;"><strong><span lang="ES">Con el botón de Nueva partida: </span></strong><span lang="ES">A la hora de activar este botón fue bastante complicado. Al principio cada vez que se le pulsaba, aparecía una partida nueva pero en un nuevo frame, de forma que cada vez que le pulsases se iban acumulando las ventanas una encima de otra. Esto no era lo que nosotros queríamos. Para llegar a que saliese en la misma ventana que en la que empezamos la primera partida, tuvimos que crear varios métodos, el NuevaPartida(), Panel(), Limpia(), …</span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><strong><span lang="ES"><span style="font-size:small;">Para actualizar los paneles.</span></span></strong></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><strong><span lang="ES"><span style="font-size:small;">Enganchar la GUI con el algoritmo del juego.</span></span></strong></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 30pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">-</span><span> </span></span></span><strong><span lang="ES"><span style="font-size:small;">Lectura externa desde un fichero.</span></span></strong></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span style="font-size:small;"><span style="font-family:Wingdings;"><span>à</span></span><span style="font-family:Times New Roman;"><span lang="EN-GB"> </span><span style="text-decoration:underline;"><span lang="ES">MEJORAS.</span></span></span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="ES">Siempre se puede mejorar. De hecho, podríamos estar años con él y años dedicaríamos a colocar mejoras, solventar errores,… Entonces, es imposible evitar que surja algún problema en algún momento de vida del juego, aunque nosotros hemos intentado controlarlos y dejarlo lo mejor posible.</span><span lang="ES"> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Ideas que han ido surgiendo para innovar el juego a raíz de enseñárselo a gente y de jugar nosotros fueron:</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<ul style="margin-top:0;" type="disc">
<li class="MsoNormal"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Pistas, dar pistas sobre la palabra a adivinar.</span></span></span></li>
<li class="MsoNormal"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Temas, colocar más temas a elegir.</span></span></span></li>
<li class="MsoNormal"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Más oportunidades para acertar la palabra.</span></span></span></li>
</ul>
<p class="MsoNormal" style="margin:0 0 0 18pt;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><strong><span style="font-family:Wingdings;"><span>à</span></span></strong><span style="font-family:Times New Roman;"><strong><span lang="EN-GB"> <span style="text-decoration:underline;">CONCLUSIÓN.</span></span></strong></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">En un principio no íbamos a hacer el juego, porque necesita emplear muchísimo tiempo y queremos aprobar el mayor número posible de asignaturas, pero cambiamos de opinión con la práctica 2, y nos decidimos a ello.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Programar el juego nos ha servido, más que nada, a aprender a utilizar SWING y a surfear por el API. A cualquier duda, mirábamos en el API. Fue un gran amigo nuestro. El mayor problema era el idioma, pero entre los dos y el diccionario como nuestro aliado, después de largos ratos, se podían sacar cosas en claro. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Hemos aprendido mucho sobre SWING.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Para mostrar como ha ido evolucionando nuestro juego y su código, y nosotros con él, hemos hecho “un viaje” en el tiempo. En el anexo2 se puede apreciar los pasos que hemos dado, desde nuestro aprendizaje a la actualidad.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"><a title="Ahorcado" href="http://rapidshare.com/files/120264169/Ahorcado.zip.html" target="_blank">Descargar Código y Documentación</a></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"><a title="Ejecutable Ahorcado" href="http://rapidshare.com/files/120808763/AhorcadoI.zip.html" target="_blank">Descargar ejecutable ( Ahorcado.jar)</a></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">PD: Para ejecutar el juego se necesita que este instalado JVM en tu ordenador. Si no lo tienes lo puedes <a title="Download JVM" href="http://www.java.com/es/download/index.jsp" target="_blank">descargar de aqui.</a></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p><a rel="license" href="http://creativecommons.org/licenses/by-nc/2.5/es/"><img style="border-width:0;" src="http://i.creativecommons.org/l/by-nc/2.5/es/88x31.png" alt="Creative Commons License" /></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/albalba.wordpress.com/101/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/albalba.wordpress.com/101/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/albalba.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/albalba.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/albalba.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/albalba.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/albalba.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/albalba.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/albalba.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/albalba.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/albalba.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/albalba.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=albalba.wordpress.com&blog=2928136&post=101&subd=albalba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://albalba.wordpress.com/2008/06/05/ultimo-episodio-el-juego/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01d14aa501d23992c6b5343fee709397?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">albalba &#38; rodri</media:title>
		</media:content>

		<media:content url="http://albalba.files.wordpress.com/2008/06/aho1.jpg?w=163" medium="image" />

		<media:content url="http://albalba.files.wordpress.com/2008/06/cerditos1.jpg" medium="image" />

		<media:content url="http://albalba.files.wordpress.com/2008/06/instrucciones.jpg" medium="image" />

		<media:content url="http://albalba.files.wordpress.com/2008/06/opciones.jpg" medium="image" />

		<media:content url="http://albalba.files.wordpress.com/2008/06/juego.jpg" medium="image" />

		<media:content url="http://albalba.files.wordpress.com/2008/06/juego2.jpg" medium="image" />

		<media:content url="http://albalba.files.wordpress.com/2008/06/ganar.jpg" medium="image" />

		<media:content url="http://i.creativecommons.org/l/by-nc/2.5/es/88x31.png" medium="image">
			<media:title type="html">Creative Commons License</media:title>
		</media:content>
	</item>
		<item>
		<title>EL SIMULACRO DE EXAMEN</title>
		<link>http://albalba.wordpress.com/2008/05/30/el-simulacro-de-examen/</link>
		<comments>http://albalba.wordpress.com/2008/05/30/el-simulacro-de-examen/#comments</comments>
		<pubDate>Fri, 30 May 2008 12:57:43 +0000</pubDate>
		<dc:creator>albalba</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://albalba.wordpress.com/?p=100</guid>
		<description><![CDATA[Tchan, tchan, tchan, tchaaaaaaaaaaan!! 
El simulacro no me ha ido muy bien. Yo necesito más tiempo para pensar las cosas. Además, mi visión espacial es nula y para imaginarme a la piececita dando vueltas, me ponía malaaaaaaaaaa…  ahora comprendo a los compañeros que están cursando de nuevo esta asignatura, cuando me decían que el juego [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=albalba.wordpress.com&blog=2928136&post=100&subd=albalba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Tchan, tchan, tchan, tchaaaaaaaaaaan!! </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">El simulacro no me ha ido muy bien. Yo necesito más tiempo para pensar las cosas. Además, mi visión espacial es nula y para imaginarme a la piececita dando vueltas, me ponía malaaaaaaaaaa…<span>  </span>ahora comprendo a los compañeros que están cursando de nuevo esta asignatura, cuando me decían que el juego del examen es imposible. Imposible no es, pero si creo que requiere de más tiempo para procesarlo, pensarlo, y escribirlo. También es bastante complicado el juego del examen. Para cuando quise empezar el segundo ejercicio SE ME HABÍA ACABADO EL TIEMPO. Lo desperdicié todo pensando en el dichoso tetris. Con lo que me gustaba a mi ese juego, hasta ahora que le he pillao’ “tirria”. </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">A Rodri le ha ido mejor, él tiene más visión espacial.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Yo me tiro todo el santo día con Java, es la asignatura a la que más hago caso, la que más empollo. Hay que tener en cuenta que para el simulacro de examen, nadie iba con todo aprendido a la perfección, pero con lo que he estudiado …. No era fallo de falta de estudio, de no saber sobre el tema, en mi opinión lo que a mi me pasó era falta de ideas, de comprender lo que piden y quedarte en ese bucle de: ”¿ésto se hará así? No, así no puede ser ¿entonces “asao”? ”, perdiendo todo el tiempo del mundo tan solo en pensar.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Ambos teníamos esperanzas de aprobar el examen de junio, pero con este simulacro nos hemos quedado por los suelos. Como dijo la delegada en clase cuando expuso su juego, esta es una asignatura que no se aprueba a la primera. </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">De la segunda parte, para que hablar. Por lo visto, dijeron los compañeros que en la solución que había por allí rondando, aparecía implementado con un vector. Pufff…vectores…</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">En clase nos preguntaron si volveríamos a hacer el simulacro de examen o no. En parte si y en parte no. En parte si, porque te enfrentas a lo que va a ser el examen para hacerte una idea. Pero por otra parte no porque salimos todos de allí muy desanimados. Los unos a los otros nos decíamos que si después de estudiar tanto no aprobábamos, una de dos, o nos pegábamos un tiro, nos íbamos a ADE o a un grado superior. Tanto currar para que después los de grado superior cobren más que nosotros y los prefieran. ¡¡¡¡QUÉ DESÁNIMO POR DIOS!!!!</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Rezaremos para que una luz nos ilumine en medio de un aula oscura para poder aprobar…</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Hasta pronto. Y suerte a todos.</span></p>
<p> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/albalba.wordpress.com/100/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/albalba.wordpress.com/100/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/albalba.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/albalba.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/albalba.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/albalba.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/albalba.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/albalba.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/albalba.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/albalba.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/albalba.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/albalba.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=albalba.wordpress.com&blog=2928136&post=100&subd=albalba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://albalba.wordpress.com/2008/05/30/el-simulacro-de-examen/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01d14aa501d23992c6b5343fee709397?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">albalba &#38; rodri</media:title>
		</media:content>
	</item>
		<item>
		<title>Práctica 12</title>
		<link>http://albalba.wordpress.com/2008/05/28/practica-12/</link>
		<comments>http://albalba.wordpress.com/2008/05/28/practica-12/#comments</comments>
		<pubDate>Wed, 28 May 2008 19:43:23 +0000</pubDate>
		<dc:creator>albalba</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://albalba.wordpress.com/?p=99</guid>
		<description><![CDATA[Bienvenidos señoras y señores lectores a la …ÚLTIMA PRÁCTICA DE OCA!!! BIEEEEEEEEEEEEEEEN!!! Ahora tan solo… queda…empollarla….TAN SOLOOOOOOOOOOOOOO!!!
Pues bien, como anécdota comentar que tuvimos que empezar la clase a oscuras jaja, ya que se fue la luz en las aulas y el pasillo pero no en los ordenadores. Al poco tiempo, nuestras plegarias fueron escuchadas XD, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=albalba.wordpress.com&blog=2928136&post=99&subd=albalba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Bienvenidos señoras y señores lectores a la …ÚLTIMA PRÁCTICA DE OCA!!! BIEEEEEEEEEEEEEEEN!!! Ahora tan solo… queda…empollarla….TAN SOLOOOOOOOOOOOOOO!!!</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Pues bien, como anécdota comentar que tuvimos que empezar la clase a oscuras jaja, ya que se fue la luz en las aulas y el pasillo pero no en los ordenadores. Al poco tiempo, nuestras plegarias fueron escuchadas XD, Y SE HIZO LA LUZ. Momento en el que, aunque hubiese luz, llegó el infierno. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">JMF nos resultó más raro que complicado. Resulta que es otra librería que hay que instalar aparte, e incluso tiene API PROPIO!!! </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Lo primero que hicimos fue cotillear el API nuevo, muy parecido al de siempre, pero en el fondo, muy diferente. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Tras esto, para poder utilizarlo, hay que configurarlo en la máquina. Para ello se podía lograr de tres maneras. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Con javac –classpath…. se le dice a la máquina que use este nuevo classpath y se olvide del otro, pero el precio que pagamos es que esta sentencia, sólo vale para un uso del compilador. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">En cambio, con la sentencia set CLASSPATH=”.;/ruta completa/jmf.jar;/ruta completa/sound.jar; la ventana se queda configurada mientras se encuentre abierta. En el momento que la cierres y la vuelvas a abrir deberás colocar la sentencia completa de nuevo.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">La forma de dejarlo configurado ya para “jamás de los jamases”, es configurarlo en panel de control, bla bla bla, variables de entorno, variables de sistema, como cuando se instala el classpath de java desde cero. Ay (suspiro), aquella época en el que nuestro mayor problema era configurar el java en el ordena de nuestra casa, ay! Bueno, que como ya existe el classpath, le añadimos las nuevas rutas del JMF y santas pascuas.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">El objetivo de la práctica, era crear mediante las herramientas que nos ofrece Java Media Framework, un VDCMediaPlayer, vamos, un programa que tenga botones de play, stop,… para el video, y un visualizador.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Para todo esto, hay que utilizar una ventana JFrame de Swing, extraer su contentPane y añadir sus componentes visuales mediante add. Es más fácil leerlo que hacerlo. En el API encontramos lo siguiente sobre él: </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#92d050;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h2 style="margin:auto 0;"><span style="font-size:10pt;" lang="ES"><span style="font-family:Times New Roman;">javax.media</span></span><span lang="ES"><span style="font-size:large;font-family:Times New Roman;"><br />
Interface Player</span></span></h2>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">All Known Subinterfaces:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Processor.html"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Processor</span></span></a></span><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">All Known Implementing Classes:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/bean/playerbean/MediaPlayer.html"><span style="font-size:small;font-family:Times New Roman;">MediaPlayer</span></a><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"><br />
<hr size="2" /></span></span></div>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">public interface <strong>Player</strong> </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">extends </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaHandler.html"><span lang="EN-GB">MediaHandler</span></a></span><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html"><span lang="EN-GB">Controller</span></a></span><span lang="EN-GB"></span></span></span></p>
<p><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is a </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> for rendering and controlling time based media data. </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> extends the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> interface. </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> provides methods for obtaining AWT components, media processing controls, and a way to manage other </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h2 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;">How a Player Differs from a Controller</span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> relaxes some restrictions that a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> imposes on what methods can be called on a <em>Started</em> </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. It also provides a way to manage groups of </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Methods Restricted to <em>Stopped</em> Players</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">The following methods cannot be invoked on a <em>Started</em> </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. If they are, </span></span><code><span style="font-size:10pt;" lang="EN-GB">ClockStartedError</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is thrown. </span></span></span></p>
<ul type="disc">
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">setTimeBase</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">syncStart</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">deallocate</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">addController</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">removeController</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
</ul>
<h3 style="margin:auto 0;"><span lang="ES"><span style="font-size:medium;font-family:Times New Roman;">Methods Allowed on <em>Started</em> Players</span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Unlike a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, the following methods are <em>legal</em> on a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> in the <em>Started</em> state: </span></span></span></p>
<ul type="disc">
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">setMediaTime</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">setRate</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
</ul>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Invoking these methods on a <em>Started</em> </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> might initiate significant and time-consuming processing, depending on the location and type of media being processed. These methods might also cause the state of the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> to change. If this happens, the appropriate </span></span><code><span style="font-size:10pt;" lang="EN-GB">TransitionEvents</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are posted by the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> when its state changes. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">For example, a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> might have to enter the <em>Prefetching</em> state to process a </span></span><code><span style="font-size:10pt;" lang="EN-GB">setMediaTime</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> invocation. In this case, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> posts a </span></span><code><span style="font-size:10pt;" lang="EN-GB">RestartingEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, a </span></span><code><span style="font-size:10pt;" lang="EN-GB">PrefetchCompleteEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, and a </span></span><code><span style="font-size:10pt;" lang="EN-GB">StartEvent</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> as it moves from the <em>Started</em> state to <em>Prefetching</em>, back to <em>Prefetched</em>, and finally back to the <em>Started</em> state. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Methods that are Illegal on <em>Unrealized</em> Players</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">As with </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, it is illegal to call the following methods on an <em>Unrealized</em> </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">: </span></span></span></p>
<ul type="disc">
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">getTimeBase</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">setTimeBase</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">setMediaTime</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">setRate</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">setStopTime</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">getStartLatency</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
</ul>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">It is also illegal to call the following </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> methods on an <em>Unrealized</em> </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">: </span></span></span></p>
<ul type="disc">
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">getVisualComponent</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">getControlPanelComponent</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">getGainControl</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">addController</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
<li class="MsoNormal"><code><span style="font-size:10pt;" lang="ES">removeController</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
</ul>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">The </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> throws a </span></span><code><span style="font-size:10pt;" lang="EN-GB">NotRealizedError</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> if any of these methods are called while the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is in the <em>Unrealized</em> state. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Start Method </span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">As a convenience, </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> provides a </span></span><code><span style="font-size:10pt;" lang="EN-GB">start</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> method that can be invoked before a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is <em>Prefetched</em>. This method attempts to transition the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> to the <em>Started</em> state from whatever state it&#8217;s currently in. For example, if the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is <em>Unrealized</em>, </span></span><code><span style="font-size:10pt;" lang="EN-GB">start</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> implicitly calls </span></span><code><span style="font-size:10pt;" lang="EN-GB">realize</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">prefetch</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, and </span></span><code><span style="font-size:10pt;" lang="EN-GB">Clock.syncStart</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. The appropriate </span></span><code><span style="font-size:10pt;" lang="EN-GB">TransitionEvents</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are posted as the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> moves through each state on its way to <em>Started</em>. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">RestartingEvent</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">If </span></span><code><span style="font-size:10pt;" lang="EN-GB">setMediaTime</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> or </span></span><code><span style="font-size:10pt;" lang="EN-GB">setRate</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> cause a perceptible delay in the presentation of the media, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> posts a </span></span><code><span style="font-size:10pt;" lang="EN-GB">RestartingEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> and transitions to the <em>Prefetching</em> state. The previous state and target state of a </span></span><code><span style="font-size:10pt;" lang="EN-GB">RestartingEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is always <em>Started</em>. </span></span><code><span style="font-size:10pt;" lang="EN-GB">RestartingEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is a subclass of </span></span><code><span style="font-size:10pt;" lang="EN-GB">StopEvent</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">DurationUpdateEvent</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Because a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> cannot always know the duration of the media it is playing, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Duration</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> interface defines that </span></span><code><span style="font-size:10pt;" lang="EN-GB">getDuration</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> returns </span></span><code><span style="font-size:10pt;" lang="EN-GB">Duration.DURATION_UNKNOWN</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> until the duration can be determined. A </span></span><code><span style="font-size:10pt;" lang="EN-GB">DurationUpdateEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is generated when the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> can determine its duration or the if its duration changes, which can happen at any time. When the end of the media is reached, the duration should be known. </span></span></span></p>
<h2 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;">Managing other Controllers</span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">In some situations, an application might want to use a single </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> to control other </span></span><code><span style="font-size:10pt;" lang="EN-GB">Players</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> or </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. A single controlling </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> can be used to invoke </span></span><code><span style="font-size:10pt;" lang="EN-GB">start</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">stop</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">setMediaTime</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, and other methods on the entire group. The controlling </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> manages all of the state transitions and event posting. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">It is also possible to construct a simple </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> to update animations, report on media time-line progress, or provide other timing-related functions. Such </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> can operate in sync with a controlling </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Adding a Controller</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">To have a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> assume control over a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, use the </span></span><code><span style="font-size:10pt;" lang="EN-GB">addController</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> method. A </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> can not be added to a <em>Started</em>  </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. If </span></span><code><span style="font-size:10pt;" lang="EN-GB">addController</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is called on a <em>Started</em> </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, a </span></span><code><span style="font-size:10pt;" lang="EN-GB">ClockStartedError</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is thrown. An <em>Unrealized</em>  or </span></span><code><span style="font-size:10pt;" lang="EN-GB">Started</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">;</span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> cannot be added to a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">; a </span></span><code><span style="font-size:10pt;" lang="EN-GB">NotRealizedError</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is thrown if the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is <em>Unrealized</em>; a </span></span><code><span style="font-size:10pt;" lang="EN-GB">ClockStartedError</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is thrown if the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is <em>Started</em>. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Once a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> has been added, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">: </span></span></span></p>
<ul type="disc">
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Invokes </span></span><code><span style="font-size:10pt;" lang="EN-GB">setTimeBase</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> with the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player's</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span><code><span style="font-size:10pt;" lang="EN-GB">TimeBase</span></code><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">. </span><span lang="ES">If this fails, </span></span></span><code><span style="font-size:10pt;" lang="ES">addController</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> throws an </span></span><code><span style="font-size:10pt;" lang="ES">IncompatibleTimeBaseException</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">. </span></span></li>
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Synchronizes the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> with the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> using </span></span><code><span style="font-size:10pt;" lang="EN-GB">setMediaTime</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">setStopTime</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, and </span></span><code><span style="font-size:10pt;" lang="EN-GB">setRate</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></li>
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Takes the added </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller's</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> latency into account when computing the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player's</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> start latency. When </span></span><code><span style="font-size:10pt;" lang="EN-GB">getStartLatency</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is called, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> returns the greater of: its latency before the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> was added and the latency of the added </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></li>
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Takes the added </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller's</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> duration into account when computing the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player's</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> duration. When </span></span><code><span style="font-size:10pt;" lang="EN-GB">getDuration</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is called, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> returns the greater of: its duration before the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> was added and the duration of the added </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. If either of these values is DURATION_UNKNOWN, </span></span><code><span style="font-size:10pt;" lang="EN-GB">getDuration</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> returns DURATION_UNKNOWN. If either of these values is DURATION_UNBOUNDED </span></span><code><span style="font-size:10pt;" lang="EN-GB">getDuration</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> returns DURATION_UNBOUNDED. </span></span></span></li>
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Adds itself as a </span></span><code><span style="font-size:10pt;" lang="EN-GB">ControllerListener</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> for the added </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> so that it can manage the events that the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB"> generates. </span><span lang="ES">(See the <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html#events#events">Events</a> section below for more information.) </span></span></span></li>
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Invokes control methods on the added </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> in response to methods invoked on the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">. </span><span lang="ES">The methods that affect managed </span></span></span><code><span style="font-size:10pt;" lang="ES">Controllers</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> are discussed below. </span></span></li>
</ul>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Once a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> has been added to a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, methods should only be called on the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> through the managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. It is not defined how the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> or </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> will behave if methods are called directly on an added </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. You cannot place a controlling </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> under the control of a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> that it is managing; the resulting behavior is undefined. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">When a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is added to a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> does not transition the added </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> to new state, nor does the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> transition itself forward. The </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> either transitions back to the <em>realized</em> state if the added </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is <em>realized</em> or <em>prefetching</em> or it stays in the <em>prefetched</em> state if the both the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> and the added </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are in the <em>prefetched</em> state. If the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> makes a state transition as a result of adding a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> posts a </span></span><code><span style="font-size:10pt;" lang="EN-GB">TransitionEvent</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Removing a Controller</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">To stop a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> from managing another </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, call </span></span><code><span style="font-size:10pt;" lang="EN-GB">removeController</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. The managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> must be <em>Stopped</em> before </span></span><code><span style="font-size:10pt;" lang="EN-GB">removeController</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> can be called. A </span></span><code><span style="font-size:10pt;" lang="EN-GB">ClockStartedError</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is thrown if </span></span><code><span style="font-size:10pt;" lang="EN-GB">removeController</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is called on a <em>Started</em> </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">When a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is removed from a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player's</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> control, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">: </span></span></span></p>
<ul type="disc">
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Resets the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller's</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span><code><span style="font-size:10pt;" lang="EN-GB">TimeBase</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> to its default. </span></span></span></li>
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Recalculates its duration and posts a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DurationUpdateEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> if the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player's</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> duration is different without the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> added. </span></span></span></li>
<li class="MsoNormal"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Recalculates its start latency. </span></span></li>
</ul>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Setting the Media Time and Rate of a Managing Player</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">When you call </span></span><code><span style="font-size:10pt;" lang="EN-GB">setMediaTime</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> that&#8217;s managing other </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, its actions differ depending on whether or not the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is <em>Started</em>. If the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is not <em>Started</em>, it simply invokes </span></span><code><span style="font-size:10pt;" lang="EN-GB">setMediaTime</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on all of the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> it&#8217;s managing. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">If the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is <em>Started</em>, it posts a </span></span><code><span style="font-size:10pt;" lang="EN-GB">RestartingEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> and performs the following tasks for each managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">: </span></span></span></p>
<ul type="disc">
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Invokes </span></span><code><span style="font-size:10pt;" lang="EN-GB">stop</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></li>
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Invokes </span></span><code><span style="font-size:10pt;" lang="EN-GB">setMediaTime</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></li>
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Invokes </span></span><code><span style="font-size:10pt;" lang="EN-GB">prefetch</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></li>
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Waits for a </span></span><code><span style="font-size:10pt;" lang="EN-GB">PrefetchCompleteEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> from the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></li>
<li class="MsoNormal"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Invokes </span></span><code><span style="font-size:10pt;" lang="ES">syncStart</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> on the </span></span><code><span style="font-size:10pt;" lang="ES">Controller</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></li>
</ul>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">The same is true when </span></span><code><span style="font-size:10pt;" lang="EN-GB">setRate</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is called on a managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. The </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> attempts to set the specified rate on all managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, stopping and restarting the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> if necessary. If some of the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> do not support the requested rate, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> returns the rate that was actually set. All </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> are guaranteed to have been successfully set to the rate returned. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Starting a Managing Player</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">When you call </span></span><code><span style="font-size:10pt;" lang="EN-GB">start</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on a managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, all of the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> managed by the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are transitioned to the <em>Prefetched</em> state. When the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are <em>Prefetched</em>, the managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> calls </span></span><code><span style="font-size:10pt;" lang="EN-GB">syncStart</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> with a time consistent with the latencies of each of the managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Calling realize, prefetch, stop, or deallocate on a Managing Player</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">When you call </span></span><code><span style="font-size:10pt;" lang="EN-GB">realize</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">prefetch</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">stop</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, or </span></span><code><span style="font-size:10pt;" lang="EN-GB">deallocate</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on a managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> calls that method on all of the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> that it is managing. The </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> moves from one state to the next when all of its </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> have reached that state. For example, a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> in the <em>Prefetching</em> state does not transition into the <em>Prefetched</em> state until all of its managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are <em>Prefetched</em>. The </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> posts </span></span><code><span style="font-size:10pt;" lang="EN-GB">TransitionEvents</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> normally as it changes state. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Calling syncStart or setStopTime on a Managing Player</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">When you call </span></span><code><span style="font-size:10pt;" lang="EN-GB">syncStart</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> or </span></span><code><span style="font-size:10pt;" lang="EN-GB">setStopTime</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on a managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> calls that method on all of the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> that it is managing. (The </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> must be in the correct state or an error is thrown. For example, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> must be <em>Prefetched</em> before you can call </span></span><code><span style="font-size:10pt;" lang="EN-GB">syncStart</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">.) </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Setting the Time Base of a Managing Player</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">When </span></span><code><span style="font-size:10pt;" lang="EN-GB">setTimeBase</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is called on a managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> calls </span></span><code><span style="font-size:10pt;" lang="EN-GB">setTimeBase</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on all of the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> it&#8217;s managing. If </span></span><code><span style="font-size:10pt;" lang="EN-GB">setTimeBase</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> fails on any of the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, an </span></span><code><span style="font-size:10pt;" lang="EN-GB">IncompatibleTimeBaseException</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is thrown and the </span></span><code><span style="font-size:10pt;" lang="EN-GB">TimeBase</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> last used is restored for all of the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Getting the Duration of a Managing Player</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Calling </span></span><code><span style="font-size:10pt;" lang="EN-GB">getDuration</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on a managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> returns the maximum duration of all of the added </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> and the managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. If the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> or any </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> has not resolved its duration, </span></span><code><span style="font-size:10pt;" lang="EN-GB">getDuration</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> returns </span></span><code><span style="font-size:10pt;" lang="EN-GB">Duration.DURATION_UNKNOWN</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Closing a Managing Player</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">When </span></span><code><span style="font-size:10pt;" lang="EN-GB">close</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is called on a managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> all managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are closed as well. </span><a name="events"></a></span></p>
<h3 style="margin:auto 0;"><span><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Events</span></span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Most events posted by a managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are filtered by the managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. Certain events are sent directly from the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> through the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> and to the listeners registered with the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">To handle the events that a managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> can generate, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> registers a listener with the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> when it is added. Other listeners that are registered with the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> must be careful not to invoke methods on the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> while it is being managed by the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. Calling a control method on a managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> directly will produce unpredictable results. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">When a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is removed from the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player's</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> list of managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> removes itself from the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller's</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> listener list. </span></span></span></p>
<h4 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">Transition Events</span></span></span></h4>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> posts </span></span><code><span style="font-size:10pt;" lang="EN-GB">TransitionEvents</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> normally as it moves between states, but the managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> affect when the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> changes state. In general, a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> does not post a transition event until all of its managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> have posted the event. </span></span></span></p>
<h4 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">Status Change Events</span></span></span></h4>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">The managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> collects the </span></span><code><span style="font-size:10pt;" lang="EN-GB">RateChangeEvents</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">StopTimeChangeEvents</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, and </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaTimeSetEvents</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> posted by its managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> and posts a single event for the group. </span></span></span></p>
<h4 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">DurationUpdateEvent</span></span></span></h4>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> posts a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DurationUpdateEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> when it determines its duration or its duration changes. A managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player's</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> duration might change if a managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> updates or discovers its duration. In general, if a managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> posts a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DurationUpdateEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> and the new duration changes the managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player's</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> duration, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> posts a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DurationUpdateEvent</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> </span></span></span></p>
<h4 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">CachingControlEvent</span></span></span></h4>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> reposts </span></span><code><span style="font-size:10pt;" lang="EN-GB">CachingControlEvents</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> received from a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Players</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> that it manages, but otherwise ignores the events. </span></span></span></p>
<h4 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">ControllerErrorEvents</span></span></span></h4>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> immediately reposts any </span></span><code><span style="font-size:10pt;" lang="EN-GB">ControllerErrorEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> received from a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> that it is managing. After a </span></span><code><span style="font-size:10pt;" lang="EN-GB">ControllerErrorEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> has been received from a managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, a managing </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> no longer invokes any methods on the managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">; the managed </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is ignored from that point on. </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">See Also: </span></strong><span lang="EN-GB"></span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html"><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/GainControl.html"><code><span style="font-size:10pt;" lang="EN-GB">GainControl</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html"><code><span style="font-size:10pt;" lang="EN-GB">Clock</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/TransitionEvent.html"><code><span style="font-size:10pt;" lang="EN-GB">TransitionEvent</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/RestartingEvent.html"><code><span style="font-size:10pt;" lang="EN-GB">RestartingEvent</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/DurationUpdateEvent.html"><code><span style="font-size:10pt;" lang="EN-GB">DurationUpdateEvent</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">Component</span></code><span lang="EN-GB"></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><br />
<hr size="2" /></span></div>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">Fields inherited from interface javax.media.</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html">Controller</a></span></span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#LATENCY_UNKNOWN"><span lang="EN-GB">LATENCY_UNKNOWN</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#Prefetched"><span lang="EN-GB">Prefetched</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#Prefetching"><span lang="EN-GB">Prefetching</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#Realized"><span lang="EN-GB">Realized</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#Realizing"><span lang="EN-GB">Realizing</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#Started"><span lang="EN-GB">Started</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#Unrealized"><span lang="EN-GB">Unrealized</span></a></span></code><span lang="EN-GB"></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">  </span></span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">Fields inherited from interface javax.media.</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html">Clock</a></span></span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#RESET">RESET</a></span></code></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span><a name="fields_inherited_from_class_javax.media."></a><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">Fields inherited from interface javax.media.</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Duration.html">Duration</a></span></span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Duration.html#DURATION_UNBOUNDED">DURATION_UNBOUNDED</a>, <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Duration.html#DURATION_UNKNOWN">DURATION_UNKNOWN</a></span></code></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">  </span><a name="method_summary"></a></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;" colspan="2">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:18pt;" lang="ES"><span style="font-family:Times New Roman;">Method Summary</span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES"> void</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html#addController(javax.media.Controller)"><span lang="EN-GB">addController</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html"><span lang="EN-GB">Controller</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> newController)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Tells the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> to assume control of another </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="EN-GB"> </span></code><code><span style="font-size:10pt;" lang="ES">java.awt.Component</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html#getControlPanelComponent()"><span lang="EN-GB">getControlPanelComponent</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">()</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Gets the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Component</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> that provides the default user interface for controlling this </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="EN-GB"> </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/GainControl.html">GainControl</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html#getGainControl()"><span lang="EN-GB">getGainControl</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">()</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Gets the object for controlling this </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player's</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> audio gain.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="EN-GB"> </span></code><code><span style="font-size:10pt;" lang="ES">java.awt.Component</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html#getVisualComponent()"><span lang="EN-GB">getVisualComponent</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">()</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Gets the display </span></span><code><span style="font-size:10pt;" lang="EN-GB">Component</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> for this </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="EN-GB"> </span></code><code><span style="font-size:10pt;" lang="ES">void</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html#removeController(javax.media.Controller)"><span lang="EN-GB">removeController</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html"><span lang="EN-GB">Controller</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> oldController)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Tells the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> to stop controlling a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="EN-GB"> </span></code><code><span style="font-size:10pt;" lang="ES">void</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html#start()"><span lang="EN-GB">start</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">()</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Starts the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> as soon as possible.</span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">  </span></span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">Methods inherited from interface javax.media.</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaHandler.html">MediaHandler</a></span></span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaHandler.html#setSource(javax.media.protocol.DataSource)">setSource</a></span></code></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">  </span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">Methods inherited from interface javax.media.</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html">Controller</a></span></span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#addControllerListener(javax.media.ControllerListener)"><span lang="EN-GB">addControllerListener</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#close()"><span lang="EN-GB">close</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#deallocate()"><span lang="EN-GB">deallocate</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#getControl(java.lang.String)"><span lang="EN-GB">getControl</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#getControls()"><span lang="EN-GB">getControls</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#getStartLatency()"><span lang="EN-GB">getStartLatency</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#getState()"><span lang="EN-GB">getState</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#getTargetState()"><span lang="EN-GB">getTargetState</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#prefetch()"><span lang="EN-GB">prefetch</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#realize()"><span lang="EN-GB">realize</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html#removeControllerListener(javax.media.ControllerListener)"><span lang="EN-GB">removeControllerListener</span></a></span></code><span lang="EN-GB"></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">  </span></span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">Methods inherited from interface javax.media.</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html">Clock</a></span></span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#getMediaNanoseconds()"><span lang="EN-GB">getMediaNanoseconds</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#getMediaTime()"><span lang="EN-GB">getMediaTime</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#getRate()"><span lang="EN-GB">getRate</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#getStopTime()"><span lang="EN-GB">getStopTime</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#getSyncTime()"><span lang="EN-GB">getSyncTime</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#getTimeBase()"><span lang="EN-GB">getTimeBase</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#mapToTimeBase(javax.media.Time)"><span lang="EN-GB">mapToTimeBase</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#setMediaTime(javax.media.Time)"><span lang="EN-GB">setMediaTime</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#setRate(float)"><span lang="EN-GB">setRate</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#setStopTime(javax.media.Time)"><span lang="EN-GB">setStopTime</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#setTimeBase(javax.media.TimeBase)"><span lang="EN-GB">setTimeBase</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#stop()"><span lang="EN-GB">stop</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Clock.html#syncStart(javax.media.Time)"><span lang="EN-GB">syncStart</span></a></span></code><span lang="EN-GB"></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span><a name="methods_inherited_from_class_javax.media"></a><span style="font-size:small;"><span style="font-family:Times New Roman;"> </span></span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">Methods inherited from interface javax.media.</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Duration.html">Duration</a></span></span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Duration.html#getDuration()">getDuration</a></span></code></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Teníamos constancia, por la clase teórica de Rueda, de que existía la interfaz Player, que contenía los métodos getVisualComponent() y getControlPaneComponent(), los cuales utilizaremos para esta práctica:</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#92d050;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">getControlPanelComponent</span></span></span></h3>
<pre><span lang="EN-GB"><span style="font-size:x-small;">public java.awt.Component <strong>getControlPanelComponent</strong>()</span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Gets the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Component</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> that provides the default user interface for controlling this </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. If this </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> has no default control panel, </span></span><code><span style="font-size:10pt;" lang="EN-GB">getControlPanelComponent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> returns </span></span><code><span style="font-size:10pt;" lang="EN-GB">null</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Returns:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">The default control panel GUI for this </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">.</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;font-family:Times New Roman;"> </span></span></h3>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">getVisualComponent</span></span></span></h3>
<pre><span lang="EN-GB"><span style="font-size:x-small;">public java.awt.Component <strong>getVisualComponent</strong>()</span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Gets the display </span></span><code><span style="font-size:10pt;" lang="EN-GB">Component</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> for this </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. The display </span></span><code><span style="font-size:10pt;" lang="EN-GB">Component</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is where visual media is rendered. If this </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> has no visual component, </span></span><code><span style="font-size:10pt;" lang="EN-GB">getVisualComponent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> returns </span></span><code><span style="font-size:10pt;" lang="EN-GB">null</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. For example, </span></span><code><span style="font-size:10pt;" lang="EN-GB">getVisualComponent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> might return </span></span><code><span style="font-size:10pt;" lang="EN-GB">null</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> if the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> only plays audio. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Returns:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">The media display </span></span><code><span style="font-size:10pt;" lang="EN-GB">Component</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> for this </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">.</span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Para hacernos la vida más fácil también está la clase Manager. Clase que define métodos static y la puedo usar para apoyar el programa. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#92d050;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h2 style="margin:auto 0;"><span style="font-size:10pt;" lang="EN-GB"><span style="font-family:Times New Roman;">javax.media</span></span><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;"><br />
Class Manager</span></span></span></h2>
<pre><span lang="EN-GB"><span style="font-size:x-small;">java.lang.Object</span></span>
<span style="font-size:x-small;"><span lang="EN-GB"><span>  </span></span><span lang="ES">|</span></span>
<span lang="ES"><span style="font-size:x-small;"><span>  </span>+--<strong>javax.media.Manager</strong></span></span></pre>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><span style="font-size:x-small;"><br />
<hr size="2" /></span></span></div>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">public final class <strong>Manager</strong> </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">extends java.lang.Object</span></span></span></p>
<p><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is the access point for obtaining system dependent resources such as </span></span><code><span style="font-size:10pt;" lang="EN-GB">Players</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSources</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processors</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSinks</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, the system </span></span><code><span style="font-size:10pt;" lang="EN-GB">TimeBase</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, the cloneable and merging utility </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSources</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is an object used to deliver time-based multimedia data that is specific to a delivery protocol. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is an object used to control and render multimedia data that is specific to the content type of the data. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is an object similar to a Player which is used to process data and output the processed data. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSink</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is an object that takes a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> as input and renders the output to a specified destination. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> provides a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> or </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSink</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> with media data; a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> or </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSink</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> must have a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> provides access to a protocol and media independent mechanism for constructing </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSources</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">Players</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processors</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> and </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSinks</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h2 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;">Creating Players and DataSources</span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> will create</span></span><code><span style="font-size:10pt;" lang="EN-GB">Players</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> from a </span></span><code><span style="font-size:10pt;" lang="EN-GB">URL</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, a </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaLocator</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> or a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">. </span><span lang="ES">Creating a </span></span></span><code><span style="font-size:10pt;" lang="ES">Player</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> requires the following: </span></span></p>
<ul type="disc">
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Obtain the connected </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the specified protocol </span></span></span></li>
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Obtain the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> for the content-type specified by the </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> </span></span></span></li>
<li class="MsoNormal"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Attach the </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> to the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> using the </span></span><code><span style="font-size:10pt;" lang="EN-GB">setSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> method. </span></span></span></li>
</ul>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Finding DataSources by Protocol</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaLocator</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> defines a protocol for obtaining content. </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSources</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are identified by the protocol that they support. </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> uses the protocol name to find </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> classes. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">To find a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> using a </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaLocator</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> constructs a list of class names from the protocol package-prefix list and the protocol name obtained from the </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaLocator</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. For each class name in the constructed list a new </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is instantiated, the </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaLocator</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is attached, and the </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is connected. If no errors have occurred, the procces is considered finished and the connected </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is used by </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> in any following operations. If there was an error then the next class name in the list is tried. The exact details of the search algorithm is described in the method documentation below. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Finding Players by Content Type</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is a </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. A </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is a an object that reads data from a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. There are three types of supported </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">: </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaProxy</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> and </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p><code><span style="font-size:10pt;" lang="EN-GB">MediaHandlers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are identified by the content type that they support. A </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> identifies the content type of the data it produces with the </span></span><code><span style="font-size:10pt;" lang="EN-GB">getContentType</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> method. </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> uses the content type name to find instances of </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">To find a </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> using a content type name, </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> constructs a list of class names from the content package-prefix list and the content type name. For each class name in the constructed list a new </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is instantiated, and the </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is attached to the </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> using MediaHandler.setSource. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">If the </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> and the </span></span><code><span style="font-size:10pt;" lang="EN-GB">setSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> was successful the process is finished and the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is returned. If the </span></span><code><span style="font-size:10pt;" lang="EN-GB">setSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> failed, another name in the list is tried. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">If the </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is a </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaProxy</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> then a new </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is obtained from the </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaProxy</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, a new list is created for the content type the </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> supports and the whole thing is tried again. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">If a valid </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is not found then the whole procedure is repeated with &#8220;unknown&#8221; substituted for the content-type name. The &#8220;unknown&#8221; content type is supported by generic </span></span><code><span style="font-size:10pt;" lang="EN-GB">Players</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> that are capable of handling a large variety of media types, often in a platform dependent way. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">The detailed creation algorithm is specified in the methods below. </span></span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">Creating a Realized Player</span></span></span></h3>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Versions of </span></span><code><span style="font-size:10pt;" lang="EN-GB">createRealizedPlayer</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> calls are provided as an acceleration to create a Player. The returned player is in the <em>Realized</em> state. In addition to </span></span><code><span style="font-size:10pt;" lang="EN-GB">NoPlayerException</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> and </span></span><code><span style="font-size:10pt;" lang="EN-GB">IOException</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">CannotRealizeException</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> can be thrown if the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> cannot realize the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h2 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;">Creating Processors</span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="EN-GB">Processors</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are created in the same way as </span></span><code><span style="font-size:10pt;" lang="EN-GB">Players</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> as outlined above. </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> also provides an additional way to create a Processor via the </span></span><code><span style="font-size:10pt;" lang="EN-GB">createRealizedProcessor</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> call. A </span></span><code><span style="font-size:10pt;" lang="EN-GB">ProcessorModel</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is used to fully identify the input and output requirements of a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. The </span></span><code><span style="font-size:10pt;" lang="EN-GB">createRealizedProcessor</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> call takes a </span></span><code><span style="font-size:10pt;" lang="EN-GB">ProcessorModel</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> as input and create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> that adheres to the given </span></span><code><span style="font-size:10pt;" lang="EN-GB">ProcessorModel</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. The returned Processor is in the <em>Realized</em> state. The method is a blocking call. </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">If the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> fails to find a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> that fits the </span></span><code><span style="font-size:10pt;" lang="EN-GB">ProcessorModel</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, a </span></span><code><span style="font-size:10pt;" lang="EN-GB">NoProcessorException</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is thrown. If there is a problem creating and realizing a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, it will throw an </span></span><code><span style="font-size:10pt;" lang="EN-GB">IOException</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> or </span></span><code><span style="font-size:10pt;" lang="EN-GB">CannotRealizeException</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> depending on the circumstances. </span></span></span></p>
<h2 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;">Creating DataSinks</span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="EN-GB">DataSinks</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are created from an input </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaLocator</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. The </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaLocator</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> identifies the protocol and content of the </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSink</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> to be used. The search for the particular </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSink</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> class to be created is similar to the process of creating a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. The detail search and creation algorithm is described in the method documentation below. </span></span></span></p>
<h2 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;">Player and Processor Threads</span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="EN-GB">Players</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> and </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processors</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> process media data asynchronously from the main program flow. This implies that a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> or </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> must often manage one or more threads. The threads managed by the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> or </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> are not in the thread group of the application that calls </span></span><code><span style="font-size:10pt;" lang="EN-GB">createPlayer</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> or </span></span><code><span style="font-size:10pt;" lang="EN-GB">createProcessor</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h2 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;">System Time Base</span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">All </span></span><code><span style="font-size:10pt;" lang="EN-GB">Players</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> need a </span></span><code><span style="font-size:10pt;" lang="EN-GB">TimeBase</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">. Many use a system-wide </span></span><code><span style="font-size:10pt;" lang="EN-GB">TimeBase</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, often based on a time-of-day clock. </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> provides access to the system </span></span><code><span style="font-size:10pt;" lang="EN-GB">TimeBase</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> through </span></span><code><span style="font-size:10pt;" lang="EN-GB">getSystemTimeBase</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h2 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;">Cloning and Merging DataSources</span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="EN-GB">DataSources</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> can be cloned or merged. If a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is cloned, more than one </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> can use it as input. Merging more than one </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSources</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> will generate one </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> which contains all the </span></span><code><span style="font-size:10pt;" lang="EN-GB">SourceStreams</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> of the constituent </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSources</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> </span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">The </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> provides two methods: </span></span><code><span style="font-size:10pt;" lang="EN-GB">createCloneableDataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> and </span></span><code><span style="font-size:10pt;" lang="EN-GB">createMergingDataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for such purpose. </span></span></span></p>
<h2 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;">Manager Hints</span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Using the </span></span><code><span style="font-size:10pt;" lang="EN-GB">setHint</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> method, the preference for how the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> creates the objects can be specified. However, a particular implementation of the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> can choose to ignore the requested hints. </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Since: </span></strong><span lang="EN-GB"></span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">1.0 , new methods added in 2.0 </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">See Also: </span></strong><span lang="EN-GB"></span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#MAX_SECURITY"><code><span style="font-size:10pt;" lang="EN-GB">MAX_SECURITY</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#CACHING"><code><span style="font-size:10pt;" lang="EN-GB">CACHING</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#LIGHTWEIGHT_RENDERER"><code><span style="font-size:10pt;" lang="EN-GB">LIGHTWEIGHT_RENDERER</span></code></a></span><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#PLUGIN_PLAYER"><code><span style="font-size:10pt;" lang="EN-GB"></span></code></a></span></span></span></p>
<p style="margin-left:36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><code><span style="font-size:10pt;" lang="EN-GB">URL</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaLocator.html"><code><span style="font-size:10pt;" lang="EN-GB">MediaLocator</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/PackageManager.html"><code><span style="font-size:10pt;" lang="EN-GB">PackageManager</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/DataSource.html"><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/URLDataSource.html"><code><span style="font-size:10pt;" lang="EN-GB">URLDataSource</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaHandler.html"><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html"><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Processor.html"><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaProxy.html"><code><span style="font-size:10pt;" lang="EN-GB">MediaProxy</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/TimeBase.html"><code><span style="font-size:10pt;" lang="EN-GB">TimeBase</span></code></a></span><span lang="EN-GB"></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><br />
<hr size="2" /></span></div>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;" colspan="2">
<p class="MsoNormal" style="margin:0;"><a name="field_summary"></a><strong><span style="font-size:18pt;" lang="ES"><span style="font-family:Times New Roman;">Field Summary</span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static int</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#CACHING"><span lang="EN-GB">CACHING</span></a></span></strong></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"><br />
          Boolean hint to turn on/off the use of playback caching.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static int</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#LIGHTWEIGHT_RENDERER"><span lang="EN-GB">LIGHTWEIGHT_RENDERER</span></a></span></strong></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"><br />
          Boolean hint to turn on/off the use of light weight rendering.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static int</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#MAX_SECURITY"><span lang="EN-GB">MAX_SECURITY</span></a></span></strong></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"><br />
          Boolean hint to turn on/off maximum security.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static int</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#PLUGIN_PLAYER"><span lang="EN-GB">PLUGIN_PLAYER</span></a></span></strong></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Boolean hint to request the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> to create </span></span><code><span style="font-size:10pt;" lang="EN-GB">Players</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> that support </span></span><code><span style="font-size:10pt;" lang="EN-GB">PlugIns</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static java.lang.String</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#UNKNOWN_CONTENT_NAME">UNKNOWN_CONTENT_NAME</a></span></strong></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"><br />
           </span></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">  </span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;" colspan="2">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:18pt;" lang="ES"><span style="font-family:Times New Roman;">Method Summary</span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/DataSource.html">DataSource</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createCloneableDataSource(javax.media.protocol.DataSource)"><span lang="EN-GB">createCloneableDataSource</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/DataSource.html"><span lang="EN-GB">DataSource</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> source)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Creates a cloneable </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/DataSink.html">DataSink</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createDataSink(javax.media.protocol.DataSource, javax.media.MediaLocator)"><span lang="EN-GB">createDataSink</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/DataSource.html"><span lang="EN-GB">DataSource</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> datasource, </span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaLocator.html"><span lang="EN-GB">MediaLocator</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> destLocator)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSink</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the specified input Datasource and destination Medialocator.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/DataSource.html">DataSource</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createDataSource(javax.media.MediaLocator)"><span lang="EN-GB">createDataSource</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaLocator.html"><span lang="EN-GB">MediaLocator</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> sourceLocator)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the specified media.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/DataSource.html">DataSource</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createDataSource(java.net.URL)"><span lang="EN-GB">createDataSource</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(java.net.URL sourceURL)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the specified media.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/DataSource.html">DataSource</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createMergingDataSource(javax.media.protocol.DataSource[])"><span lang="EN-GB">createMergingDataSource</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/DataSource.html"><span lang="EN-GB">DataSource</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB">[] sources)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Creates a merged </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> from an array of sources.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html">Player</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createPlayer(javax.media.protocol.DataSource)"><span lang="EN-GB">createPlayer</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/DataSource.html"><span lang="EN-GB">DataSource</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> source)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> for the </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html">Player</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createPlayer(javax.media.MediaLocator)"><span lang="EN-GB">createPlayer</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaLocator.html"><span lang="EN-GB">MediaLocator</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> sourceLocator)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the specified media.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html">Player</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createPlayer(java.net.URL)"><span lang="EN-GB">createPlayer</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(java.net.URL sourceURL)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the specified media.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Processor.html">Processor</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createProcessor(javax.media.protocol.DataSource)"><span lang="EN-GB">createProcessor</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/DataSource.html"><span lang="EN-GB">DataSource</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> source)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> for the </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Processor.html">Processor</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createProcessor(javax.media.MediaLocator)"><span lang="EN-GB">createProcessor</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaLocator.html"><span lang="EN-GB">MediaLocator</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> sourceLocator)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the specified media.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Processor.html">Processor</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createProcessor(java.net.URL)"><span lang="EN-GB">createProcessor</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(java.net.URL sourceURL)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the specified media.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html">Player</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createRealizedPlayer(javax.media.protocol.DataSource)"><span lang="EN-GB">createRealizedPlayer</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/DataSource.html"><span lang="EN-GB">DataSource</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> source)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a Realized </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the specified source.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html">Player</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createRealizedPlayer(javax.media.MediaLocator)"><span lang="EN-GB">createRealizedPlayer</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaLocator.html"><span lang="EN-GB">MediaLocator</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> ml)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a Realized </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the specified media.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html">Player</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createRealizedPlayer(java.net.URL)"><span lang="EN-GB">createRealizedPlayer</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(java.net.URL sourceURL)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a Realized </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the specified media.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Processor.html">Processor</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#createRealizedProcessor(javax.media.ProcessorModel)"><span lang="EN-GB">createRealizedProcessor</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ProcessorModel.html"><span lang="EN-GB">ProcessorModel</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> model)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Create a Realized </span></span><code><span style="font-size:10pt;" lang="EN-GB">Processor</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> for the specified </span></span><code><span style="font-size:10pt;" lang="EN-GB">ProcessorModel</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static java.lang.String</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#getCacheDirectory()"><span lang="EN-GB">getCacheDirectory</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">()</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"><br />
          Retrieve the directory that&#8217;s used for playback caching.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static java.util.Vector</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#getDataSourceList(java.lang.String)"><span lang="EN-GB">getDataSourceList</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(java.lang.String protocolName)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Build a list of </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> class names from the protocol prefix-list and a protocol name.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static java.util.Vector</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#getHandlerClassList(java.lang.String)"><span lang="EN-GB">getHandlerClassList</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(java.lang.String contentName)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Build a list of Player </span></span><code><span style="font-size:10pt;" lang="EN-GB">Handler</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> classes from the content-prefix-list and a content name.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static java.lang.Object</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#getHint(int)"><span lang="EN-GB">getHint</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(int hint)</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"><br />
          Retrieve the value of a hint set.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static java.util.Vector</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#getProcessorClassList(java.lang.String)"><span lang="EN-GB">getProcessorClassList</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(java.lang.String contentName)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Build a list of Processor </span></span><code><span style="font-size:10pt;" lang="EN-GB">Handler</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> classes from the content-prefix-list and a content name.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/TimeBase.html">TimeBase</a></span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#getSystemTimeBase()"><span lang="EN-GB">getSystemTimeBase</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">()</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"><br />
          Get the time-base object for the system.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static java.lang.String</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#getVersion()"><span lang="EN-GB">getVersion</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">()</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"><br />
          Returns the version string for this revision of JMF.</span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES">static void</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Manager.html#setHint(int, java.lang.Object)"><span lang="EN-GB">setHint</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(int hint, java.lang.Object value)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          Specify a hint for the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Manager</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> to use.</span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span><a name="methods_inherited_from_class_java.lang.O"></a><span style="font-size:small;"><span style="font-family:Times New Roman;"> </span></span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Methods inherited from class java.lang.Object</span></strong><span lang="EN-GB"></span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="EN-GB">clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</span></code><span lang="EN-GB"></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">  </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Como no se puede hacer Player p = new Player(…); <strong><span style="color:red;">¡¡ERROR!!</span></strong> ya que Player es una interfaz, por lo que nos ayudamos de la clase Manager para crear un objeto Player. Un método que contiene Manager es el createPlayer, al que se le puede pasar por parámetro un DataSource, un MediaLocator o una URL (un fichero local se puede escribir como URL), porque necesita un reproductor de algo. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<h3 style="margin:auto 0;"><a name="createPlayer(javax.media.MediaLocator)"></a><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">createPlayer</span></span></span></h3>
<table class="MsoTableGrid" style="background:#92d050;border-collapse:collapse;margin:auto auto auto 36pt;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<pre><span style="font-size:x-small;"><span lang="EN-GB">public static </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html"><span lang="EN-GB">Player</span></a></span><span lang="ES"> </span><strong><span lang="EN-GB">createPlayer</span></strong><span lang="EN-GB">(</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaLocator.html"><span lang="EN-GB">MediaLocator</span></a></span><span lang="EN-GB"> sourceLocator)</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>                           </span>throws java.io.IOException,</span></span>
<span style="font-size:x-small;"><span lang="EN-GB"><span>                                  </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/NoPlayerException.html"><span lang="EN-GB">NoPlayerException</span></a></span><span lang="EN-GB"></span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the specified media. </span></span></span></p>
<p style="margin-left:36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">The algorithm for creating a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> from a </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaLocator</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is: </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 72pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">1.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Get the protocol from the </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaLocator</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 72pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">2.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Get a list of </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> classes that support the protocol, using the protocol package-prefix-list. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 72pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">3.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">For each source class in the list: </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">1.</span><span style="font:7pt &quot;">      </span></span></span><span lang="ES"><span style="font-size:small;">Instantiate a new </span></span></span><code><span style="font-size:10pt;" lang="ES">DataSource</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">, </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">2.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Call the </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">connect</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> method to connect the source. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">3.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Get the media content-type-name (using </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">getContentType</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">) from the source. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">4.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Get a list of </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> classes that support the media-content-type-name, using the content package-prefix-list. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">5.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">For each </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> class in the list: </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 144pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">1.</span><span style="font:7pt &quot;">      </span></span></span><span lang="ES"><span style="font-size:small;">Instantiate a new </span></span></span><code><span style="font-size:10pt;" lang="ES">MediaHandler</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">. </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 144pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">2.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Attach the source to the </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> by calling </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler.setSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 144pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">3.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">If there are no failures, determine the type of the </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">; otherwise try the next MediaHandler in the list. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 144pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">4.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">If the </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, return the new </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 144pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">5.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">If the </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is a </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaProxy</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, obtain a new </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> from the </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaProxy</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, obtain the list of </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandlers</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> that support the new </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">, and continue searching the new list. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">6.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">If no </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is found for this source, try the next source in the list. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 72pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">4.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">If no </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB"> is found after trying all of the sources, reuse the source list.<br />
</span><span lang="ES">This time, for each source class in the list: </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">1.</span><span style="font:7pt &quot;">      </span></span></span><span lang="ES"><span style="font-size:small;">Instantiate the source. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">2.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Call the </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">connect</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> method to connect to the source. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">3.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Use the content package-prefix-list to create a list of </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> classes that support the &#8220;unknown&#8221; content-type-name. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">4.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">For each </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaHandler</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> class in the list, search for a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> as in the previous search. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 144pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">1.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">If no </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is found after trying all of the sources, a </span></span><code><span style="font-size:10pt;" lang="EN-GB">NoPlayerException</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is thrown. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Parameters:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><code><span style="font-size:10pt;" lang="EN-GB">sourceLocator</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> &#8211; A </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaLocator</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> that describes the media content. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Returns:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> for the media described by the source. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Throws:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/NoPlayerException.html"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">NoPlayerException</span></span></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> &#8211; Thrown if no </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> can be found. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">java.io.IOException &#8211; Thrown if there was a problem connecting with the source.</span></span></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"><br />
<hr size="2" /></span></span></div>
<h3 style="margin:auto 0;"><a name="createPlayer(javax.media.protocol.DataSo"></a><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">createPlayer</span></span></span></h3>
<pre><span style="font-size:x-small;"><span lang="EN-GB">public static </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html"><span lang="EN-GB">Player</span></a></span><span lang="ES"> </span><strong><span lang="EN-GB">createPlayer</span></strong><span lang="EN-GB">(</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/protocol/DataSource.html"><span lang="EN-GB">DataSource</span></a></span><span lang="EN-GB"> source)</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>                           </span>throws java.io.IOException,</span></span>
<span style="font-size:x-small;"><span lang="EN-GB"><span>                                  </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/NoPlayerException.html"><span lang="EN-GB">NoPlayerException</span></a></span><span lang="EN-GB"></span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> for the </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p style="margin-left:36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">The algorithm for creating a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> from a </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is: </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 72pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">1.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Get the media content-type-name from the source by calling </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">getContentType</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 72pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">2.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Use the content package-prefix-list to get a list of </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> classes that support the media content-type name. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 72pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">3.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">For each </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> class in the list: </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">1.</span><span style="font:7pt &quot;">      </span></span></span><span lang="ES"><span style="font-size:small;">Instantiate a new </span></span></span><code><span style="font-size:10pt;" lang="ES">Player</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">. </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">2.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Attach the source to the </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> by calling </span></span><code><span style="font-size:10pt;" lang="EN-GB">setSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">3.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">If there are no failures, return the new </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">; otherwise, try the next </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> in the list. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 72pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">4.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">If no </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is found for this source: </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">1.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Use the content package-prefix-list to create a list of </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> classes that support the &#8220;unknown&#8221; content-type-name. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 108pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">2.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">For each </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> class in the list: </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 144pt;"><span style="font-family:Times New Roman;"><span lang="ES"><span><span style="font-size:small;">1.</span><span style="font:7pt &quot;">      </span></span></span><span lang="ES"><span style="font-size:small;">Instantiate a new </span></span></span><code><span style="font-size:10pt;" lang="ES">Player</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">. </span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 144pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">2.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">Attach the source to the </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> by calling </span></span><code><span style="font-size:10pt;" lang="EN-GB">setSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> on the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 144pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">3.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">If there are no failures, return the new </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">; otherwise, try the next </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> in the list. </span></span></span></p>
<p class="MsoNormal" style="text-indent:-18pt;margin:0 0 0 72pt;"><span style="font-family:Times New Roman;"><span lang="EN-GB"><span><span style="font-size:small;">5.</span><span style="font:7pt &quot;">      </span></span></span><span lang="EN-GB"><span style="font-size:small;">If no </span></span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> can be created, a </span></span><code><span style="font-size:10pt;" lang="EN-GB">NoPlayerException</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is thrown. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Parameters:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> &#8211; The </span></span><code><span style="font-size:10pt;" lang="EN-GB">DataSource</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> that describes the media content. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Returns:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A new </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Throws:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/NoPlayerException.html"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">NoPlayerException</span></span></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> &#8211; Thrown if a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> can&#8217;t be created. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">java.io.IOException &#8211; Thrown if there was a problem connecting with the source.</span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<h3 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:medium;"><span style="font-family:Times New Roman;">createPlayer</span></span></span></h3>
<pre><span style="font-size:x-small;"><span lang="EN-GB">public static </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Player.html"><span lang="EN-GB">Player</span></a></span><span lang="ES"> </span><strong><span lang="EN-GB">createPlayer</span></strong><span lang="EN-GB">(java.net.URL sourceURL)</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>                           </span>throws java.io.IOException,</span></span>
<span style="font-size:x-small;"><span lang="EN-GB"><span>                                  </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/NoPlayerException.html"><span lang="EN-GB">NoPlayerException</span></a></span><span lang="EN-GB"></span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Create a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> for the specified media. This creates a MediaLocator from the URL and then calls </span></span><code><span style="font-size:10pt;" lang="EN-GB">createPlayer</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Parameters:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><code><span style="font-size:10pt;" lang="EN-GB">sourceURL</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> &#8211; The </span></span><code><span style="font-size:10pt;" lang="EN-GB">URL</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> that describes the media data. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Returns:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A new </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Throws:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/NoPlayerException.html"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">NoPlayerException</span></span></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> &#8211; Thrown if no </span></span><code><span style="font-size:10pt;" lang="EN-GB">Player</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> can be found. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">java.io.IOException &#8211; Thrown if there was a problem connecting with the source.</span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Una URL se compone de protocolo://destino/recurso, en resumen, compañeros tenemos que escribir file://(la ruta completa). No es válido poner “video.mpg” ya que no sigue la sintaxis.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Uno de nuestro errores fue olvidarnos de Manager y de su createPlayer, de tal forma que dijimos implementamos Player y a saco. Pero era muy engorroso, pesado y nos daba bastantes errores al compilar. Hasta que le dijimos: “Profe, ayúdanos, esto no nos sale y nos estamos haciendo la picha un lío”. Son de estas frases típicas made in Spain, que no las piensas y las sueltas sin mas, a lo que él contestó sin ningún enfado (cosa que agradecemos): “Procura no mezclar las palabras profe y picha en la misma frase.”. Ahora lo recordamos y nos reímos, pero pensándolo fríamente…QUE HABRÁ PENSADO EL PROFE!!! Desde este honrado blog, las más sinceras disculpas.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Después de todo este berenjenal, nos ayudó a recordar, percatándonos de que la manera más fácil era escribir Player p = Manager.createPlayer(…);</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">En clase se nos recordó lo explicado en la teoría sobre que un Player tiene varios estados: unrealized, realized, prefetched y started. Realized es el estado en el que se encuentra un player cuando es creado por primera vez y no tiene ningún conocimiento acerca de la fuente de datos de entrada. Por esta razón, tardará un tiempo en arrancar desconocido para nosotros. Por lo que, antes de hacer el getVisualComponent, hay que colocar p.realized(), porque no podemos reservar un tamaño para el video si no sé su tamaño. p.realized() calcula varias cosas. Realized salta al estado “me he dado cuenta” y no puedo llamar al getVisualComponent() antes de pasar a realized. Para saber cuando ocurre llamo a un escuchador de eventos.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Al player le creamos un controllerListener y se lo añadimos al panel.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#92d050;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h2 style="margin:auto 0;"><span style="font-size:10pt;" lang="EN-GB"><span style="font-family:Times New Roman;">javax.media</span></span><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;"><br />
Interface ControllerListener</span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">All Known Implementing Classes:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ControllerAdapter.html"><span style="font-size:small;font-family:Times New Roman;">ControllerAdapter</span></a><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"><br />
<hr size="2" /></span></span></div>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">public interface <strong>ControllerListener</strong></span></span></span></p>
<p><code><span style="font-size:10pt;" lang="EN-GB">ControllerListener</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is an interface for handling asynchronous events generated by </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controllers</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<h2 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;">Java Beans Support </span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">If implementations of this interface are going to be used with Java Beans they need to also implement either java.util.EventListener or sunw.util.EventListener. </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">See Also: </span></span></strong></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html"><code><span style="font-size:10pt;">Controller</span></code></a></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><br />
<hr size="2" /></span></div>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;" colspan="2">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:18pt;" lang="ES"><span style="font-family:Times New Roman;">Method Summary</span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;" lang="ES"> void</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ControllerListener.html#controllerUpdate(javax.media.ControllerEvent)"><span lang="EN-GB">controllerUpdate</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ControllerEvent.html"><span lang="EN-GB">ControllerEvent</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> event)</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"><br />
          This method is called when an event is generated by a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> that this listener is registered with.</span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">  </span></span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><a name="method_detail"></a><strong><span style="font-size:18pt;" lang="ES"><span style="font-family:Times New Roman;">Method Detail</span></span></strong></p>
</td>
</tr>
</tbody>
</table>
<h3 style="margin:auto 0;"><a name="controllerUpdate(javax.media.ControllerE"></a><span lang="ES"><span style="font-size:medium;font-family:Times New Roman;">controllerUpdate</span></span></h3>
<pre><span style="font-size:x-small;"><span lang="EN-GB">public void <strong>controllerUpdate</strong>(</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ControllerEvent.html"><span lang="EN-GB">ControllerEvent</span></a></span><span lang="EN-GB"> event)</span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">This method is called when an event is generated by a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> that this listener is registered with. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Parameters:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><code><span style="font-size:10pt;" lang="EN-GB">event</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> &#8211; The event generated.</span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">ControllerListener sólo tiene un método, que hay que redefinir en nuestra clase. Éste se lanza cuando ocurre un evento. Es un método para todos los eventos, entonces, dentro del método, hay que distinguir entre los diferentes eventos que nos pueden aparecer. Cuando ocurra un evento llegará un objeto que hereda de MediaEvent. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#92d050;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h2 style="margin:auto 0;"><span style="font-size:10pt;" lang="EN-GB"><span style="font-family:Times New Roman;">javax.media</span></span><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;"><br />
Class MediaEvent</span></span></span></h2>
<pre><span lang="EN-GB"><span style="font-size:x-small;">java.lang.Object</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>  </span>|</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>  </span>+--java.util.EventObject</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>        </span>|</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>        </span>+--<strong>javax.media.MediaEvent</strong></span></span></pre>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Direct Known Subclasses:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ControllerEvent.html"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">ControllerEvent</span></span></a></span><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/datasink/DataSinkEvent.html"><span lang="EN-GB">DataSinkEvent</span></a></span><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/GainChangeEvent.html"><span lang="EN-GB">GainChangeEvent</span></a></span><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/rtp/event/RTPEvent.html"><span lang="EN-GB">RTPEvent</span></a></span><span lang="EN-GB"> </span></span></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"><br />
<hr size="2" /></span></span></div>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">public class <strong>MediaEvent</strong> </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">extends java.util.EventObject</span></span></span></p>
<p><code><span style="font-size:10pt;" lang="EN-GB">MediaEvent</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is the base interface for media events. </span></span></span></p>
<p><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">This is similar to the JMF 1.0 </span><span lang="ES"><a href="http://www.javasoft.com/products/java-media/jmf/forDevelopers/playerapi/javax.media.MediaEvent.html"><span lang="EN-GB">MediaEvent </span></a></span><span lang="EN-GB">interface, except it&#8217;s a class. </span></span></span></p>
<h2 style="margin:auto 0;"><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;">Java Beans support </span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">In order to support the Java Beans event model an implementation of MediaEvent is required to sub-class java.util.EventObject. If an implementation is designed to support the 1.0.2 JDK then it may alternatively sub-class sunw.util.EventObject to provide the support appropriate support. </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">See Also: </span></span></strong></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/serialized-form.html#javax.media.MediaEvent"><span style="font-size:small;font-family:Times New Roman;">Serialized Form</span></a></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"><br />
<hr size="2" /></span></span></div>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><a name="fields_inherited_from_class_java.util.Ev"></a><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Fields inherited from class java.util.EventObject</span></strong><span lang="EN-GB"></span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="ES">source</span></code></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">  </span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;" colspan="2">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:18pt;" lang="ES"><span style="font-family:Times New Roman;">Constructor Summary</span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaEvent.html#MediaEvent(java.lang.Object)"><span lang="EN-GB">MediaEvent</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(java.lang.Object source)</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"><br />
           </span></span></span></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;" lang="EN-GB"><span style="font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">  </span><a name="methods_inherited_from_class_java.util.E"></a></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Methods inherited from class java.util.EventObject</span></strong><span lang="EN-GB"></span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="ES">getSource, toString</span></code></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">  </span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Methods inherited from class java.lang.Object</span></strong><span lang="EN-GB"></span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="EN-GB">clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</span></code><span lang="EN-GB"></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">  </span></span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><a name="constructor_detail"></a><strong><span style="font-size:18pt;" lang="ES"><span style="font-family:Times New Roman;">Constructor Detail</span></span></strong></p>
</td>
</tr>
</tbody>
</table>
<h3 style="margin:auto 0;"><a name="MediaEvent(java.lang.Object)"></a><span lang="ES"><span style="font-size:medium;font-family:Times New Roman;">MediaEvent</span></span></h3>
<pre><span lang="EN-GB"><span style="font-size:x-small;">public <strong>MediaEvent</strong>(java.lang.Object source)</span></span></pre>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Podemos hacer un instanceOf de tal forma que si llega un evento, ya se puede actuar, y sacamos el getVisualComponent(). El evento que de verdad nos interesa es RealizeCompleteEvent.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#92d050;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h2 style="margin:auto 0;"><span style="font-size:10pt;" lang="EN-GB"><span style="font-family:Times New Roman;">javax.media</span></span><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;"><br />
Class RealizeCompleteEvent</span></span></span></h2>
<pre><span lang="EN-GB"><span style="font-size:x-small;">java.lang.Object</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>  </span>|</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>  </span>+--java.util.EventObject</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>        </span>|</span></span>
<span style="font-size:x-small;"><span lang="EN-GB"><span>        </span>+--</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaEvent.html"><span lang="EN-GB">javax.media.MediaEvent</span></a></span><span lang="EN-GB"></span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>              </span>|</span></span>
<span style="font-size:x-small;"><span lang="EN-GB"><span>              </span>+--</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ControllerEvent.html"><span lang="EN-GB">javax.media.ControllerEvent</span></a></span><span lang="EN-GB"></span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>                    </span>|</span></span>
<span style="font-size:x-small;"><span lang="EN-GB"><span>                    </span>+--</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/TransitionEvent.html"><span lang="EN-GB">javax.media.TransitionEvent</span></a></span><span lang="EN-GB"></span></span>
<span style="font-size:x-small;"><span lang="EN-GB"><span>                          </span></span><span lang="ES">|</span></span>
<span lang="ES"><span style="font-size:x-small;"><span>                          </span>+--<strong>javax.media.RealizeCompleteEvent</strong></span></span></pre>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><span style="font-size:x-small;"><br />
<hr size="2" /></span></span></div>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">public class <strong>RealizeCompleteEvent</strong> </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">extends </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/TransitionEvent.html"><span lang="EN-GB">TransitionEvent</span></a></span><span lang="EN-GB"></span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A </span></span><code><span style="font-size:10pt;" lang="EN-GB">RealizeCompleteEvent</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> is posted when a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> finishes <em>Realizing</em>. This occurs when a </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> moves from the <em>Realizing</em> state to the <em>Realized</em> state, or as an acknowledgement that the </span></span><code><span style="font-size:10pt;" lang="EN-GB">realize</span></code><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> method was called and the </span></span><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is already <em>Realized</em>. </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">See Also: </span></strong><span lang="EN-GB"></span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html"><code><span style="font-size:10pt;" lang="EN-GB">Controller</span></code></a></span><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ControllerListener.html"><code><span style="font-size:10pt;" lang="EN-GB">ControllerListener</span></code></a></span><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/serialized-form.html#javax.media.RealizeCompleteEvent"><span lang="EN-GB">Serialized Form</span></a></span><span lang="EN-GB"></span></span></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"><br />
<hr size="2" /></span></span></div>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Fields inherited from class java.util.EventObject</span></strong><span lang="EN-GB"></span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="ES">source</span></code></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">  </span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;" colspan="2">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:18pt;" lang="ES"><span style="font-family:Times New Roman;">Constructor Summary</span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/RealizeCompleteEvent.html#RealizeCompleteEvent(javax.media.Controller, int, int, int)"><span lang="EN-GB">RealizeCompleteEvent</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html"><span lang="EN-GB">Controller</span></a></span></code><code><span style="font-size:10pt;" lang="EN-GB"> from, int previous, int current, int target)</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"><br />
           </span></span></span></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;" lang="EN-GB"><span style="font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">  </span></span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">Methods inherited from class javax.media.</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/TransitionEvent.html">TransitionEvent</a></span></span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/TransitionEvent.html#getCurrentState()">getCurrentState</a>, <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/TransitionEvent.html#getPreviousState()">getPreviousState</a>, <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/TransitionEvent.html#getTargetState()">getTargetState</a>, <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/TransitionEvent.html#toString()">toString</a></span></code></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">  </span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">Methods inherited from class javax.media.</span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ControllerEvent.html">ControllerEvent</a></span></span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ControllerEvent.html#getSource()">getSource</a>, <a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ControllerEvent.html#getSourceController()">getSourceController</a></span></code></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">  </span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Methods inherited from class java.lang.Object</span></strong><span lang="EN-GB"></span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="EN-GB">clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</span></code><span lang="EN-GB"></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">  </span></span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:18pt;" lang="ES"><span style="font-family:Times New Roman;">Constructor Detail</span></span></strong></p>
</td>
</tr>
</tbody>
</table>
<h3 style="margin:auto 0;"><a name="RealizeCompleteEvent(javax.media.Control"></a><span lang="ES"><span style="font-size:medium;font-family:Times New Roman;">RealizeCompleteEvent</span></span></h3>
<pre><span lang="ES"><span style="font-size:x-small;">public <strong>RealizeCompleteEvent</strong>(</span><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/Controller.html"><span style="font-size:x-small;">Controller</span></a><span style="font-size:x-small;"> from,</span></span>
<span lang="ES"><span style="font-size:x-small;"><span>                            </span>int previous,</span></span>
<span lang="ES"><span style="font-size:x-small;"><span>                            </span>int current,</span></span>
<span lang="ES"><span style="font-size:x-small;"><span>                            </span>int target)</span></span></pre>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Otra forma de hacerlo es con hilos. Se puede colocar entre el método realized() y el getVisualComponent(), un Thread.sleep(..) a un tiempo, el que se quiera. Este es el camino erróneo, porque con el tiempo que se coloque en el sleep, si cojo tiempo de más, desperdicio tiempo de espera, y si cojo de menos, nos sale el tiro por la culata. Además de que hilos da mucho problemas. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Esta es una mala solución. En lugar de esperar un tiempo arbitrario, lo mejor es programar con el modo de controlar los eventos, el escuchador,… y toda esa parrafada.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">¡¡CUIDADO!! Advertencia, el formato de video que se puede usar en JMF depende de la versión del JMF instalado. Si se intenta usar uno que no está instalado, saltará una popi excepción, UnableToHandleFormatException, o algo parecido.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Teóricamente sabíamos lo que había que hacer, pero después estabas frente al ordenador como si tuvieses un toro delante. Después de intentar implementar la interfaz Player, usamos a Manager. Llegados a este punto, nos perdimos. No sabíamos como seguir. Miramos en el API, le dimos muchas vueltas,… nada sirvió. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">No paraban de saltarnos errores. Al principio tonterías de que faltaba importar paquetes. Hasta que llegó un momento que ni comprendimos los errores que salían. Intentamos seguir las instrucciones que se nos explicaron durante la clase, pero no sacábamos nada en claro, tan solo errores.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Hay que tener especial cuidado con el control de excepciones. A nosotros nos salieron el famosísimo IOException y MediaException, los cuales eliminamos rápidamente con un try y catch.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#92d050;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h2 style="margin:auto 0;"><span style="font-size:10pt;" lang="EN-GB"><span style="font-family:Times New Roman;">javax.media</span></span><span lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;"><br />
Class MediaException</span></span></span></h2>
<pre><span lang="EN-GB"><span style="font-size:x-small;">java.lang.Object</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>  </span>|</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>  </span>+--java.lang.Throwable</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>        </span>|</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>        </span>+--java.lang.Exception</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>         </span><span>     </span>|</span></span>
<span lang="EN-GB"><span style="font-size:x-small;"><span>              </span>+--<strong>javax.media.MediaException</strong></span></span></pre>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Direct Known Subclasses:</span></strong><span lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/BadHeaderException.html"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">BadHeaderException</span></span></a></span><span style="font-size:small;"><span style="font-family:Times New Roman;"><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/CannotRealizeException.html"><span lang="EN-GB">CannotRealizeException</span></a></span><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ClockStoppedException.html"><span lang="EN-GB">ClockStoppedException</span></a></span><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/IncompatibleSourceException.html"><span lang="EN-GB">IncompatibleSourceException</span></a></span><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/IncompatibleTimeBaseException.html"><span lang="EN-GB">IncompatibleTimeBaseException</span></a></span><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/NoDataSinkException.html"><span lang="EN-GB">NoDataSinkException</span></a></span><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/NoDataSourceException.html"><span lang="EN-GB">NoDataSourceException</span></a></span><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/NoPlayerException.html"><span lang="EN-GB">NoPlayerException</span></a></span><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/ResourceUnavailableException.html"><span lang="EN-GB">ResourceUnavailableException</span></a></span><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/format/UnsupportedFormatException.html"><span lang="EN-GB">UnsupportedFormatException</span></a></span><span lang="EN-GB">, </span><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/UnsupportedPlugInException.html"><span lang="EN-GB">UnsupportedPlugInException</span></a></span><span lang="EN-GB"> </span></span></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"><br />
<hr size="2" /></span></span></div>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">public class <strong>MediaException</strong> </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">extends java.lang.Exception</span></span></span></p>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">A </span></span><code><span style="font-size:10pt;" lang="EN-GB">MediaException</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> indicates an unexpected error condition in a JMF method. </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><strong><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">See Also: </span></span></strong></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/serialized-form.html#javax.media.MediaException"><span style="font-size:small;font-family:Times New Roman;">Serialized Form</span></a></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"><br />
<hr size="2" /></span></span></div>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;" colspan="2">
<p class="MsoNormal" style="margin:0;"><a name="constructor_summary"></a><strong><span style="font-size:18pt;" lang="ES"><span style="font-family:Times New Roman;">Constructor Summary</span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaException.html#MediaException()">MediaException</a></span></strong></code><code><span style="font-size:10pt;" lang="ES">()</span></code><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"><br />
           </span></span></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;" lang="ES"><span style="font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;" lang="ES"><a href="http://www.it.uc3m.es/tsioca/jmf20-apidocs/javax/media/MediaException.html#MediaException(java.lang.String)"><span lang="EN-GB">MediaException</span></a></span></strong></code><code><span style="font-size:10pt;" lang="EN-GB">(java.lang.String reason)</span></code><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"><br />
           </span></span></span></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;" lang="EN-GB"><span style="font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">  </span><a name="methods_inherited_from_class_java.lang.T"></a></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Methods inherited from class java.lang.Throwable</span></strong><span lang="EN-GB"></span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="EN-GB">fillInStackTrace, getLocalizedMessage, getMessage, printStackTrace, printStackTrace, printStackTrace, toString</span></code><span lang="EN-GB"></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">  </span></span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#eeeeff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span lang="EN-GB">Methods inherited from class java.lang.Object</span></strong><span lang="EN-GB"></span></span></span></p>
</td>
</tr>
<tr>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><span style="font-size:10pt;" lang="EN-GB">clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</span></code><span lang="EN-GB"></span></p>
</td>
</tr>
</tbody>
</table>
<p><span lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">  </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">No logramos programar la clase. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Cuando terminó la hora, una compañera nos ayudó muuuuuuuuuuuuuuuuucho. Ella nos explicó que debíamos hacer para resolverlo. Lo resolvió como decía el profe, como nosotros intentamos, pero hay veces que te atascas y no sale ni para atrás. Aun así, nos pareció una práctica muy rara más que complicada. Es que es como siempre, una vez que la ves hecho lo entiendes, pero sino, no sabes. Esperamos que con lo que aprendimos en el aula y con la ayuda de nuestra compi ahora seamos capaces de resolver los JMF.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span lang="ES"><span style="font-family:Times New Roman;">PUES AHORA TOCA DESPEDIRSE…</span></span><span style="font-family:Wingdings;" lang="ES"><span>L</span></span><span lang="ES"><span style="font-family:Times New Roman;"> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Hacer el blog ha sido de una gran ayuda. Nos dábamos cuenta, a la hora de intentar explicar las cosas, qué no sabíamos y qué debíamos estudiar más. Además del pique que nos traíamos para ver quien de la clase colgaba primero la práctica jaja, hubo gente que la colgó a la media hora de empezar la clase, sin ni si quiera acabar jaja.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Leer los blogs de los compañeros también ayuda bastante pero eso de dejarles comentarios, se nos olvidaba siempre la verdad. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">El último post que colguemos será, seguramente para dar nuestras impresiones sobre el juego, y quizá, por qué no, sobre la asignatura. Quién sabe que futuro llegará a tener este blog.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span lang="ES"><span style="font-family:Times New Roman;">HASTA PRONTO!!! </span></span><span style="font-family:Wingdings;" lang="ES"><span>J</span></span><span lang="ES"><span style="font-family:Times New Roman;"> </span></span></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/albalba.wordpress.com/99/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/albalba.wordpress.com/99/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/albalba.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/albalba.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/albalba.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/albalba.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/albalba.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/albalba.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/albalba.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/albalba.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/albalba.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/albalba.wordpress.com/99/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=albalba.wordpress.com&blog=2928136&post=99&subd=albalba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://albalba.wordpress.com/2008/05/28/practica-12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01d14aa501d23992c6b5343fee709397?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">albalba &#38; rodri</media:title>
		</media:content>
	</item>
		<item>
		<title>Práctica 11</title>
		<link>http://albalba.wordpress.com/2008/05/27/practica-11/</link>
		<comments>http://albalba.wordpress.com/2008/05/27/practica-11/#comments</comments>
		<pubDate>Tue, 27 May 2008 19:03:48 +0000</pubDate>
		<dc:creator>albalba</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://albalba.wordpress.com/?p=98</guid>
		<description><![CDATA[Uff la última práctica de swing… NOS AUTO-DAMOS ÁNIMO Y TAMBIÉN LO MANDAMOS A LOS LECTORES!!! Ya están aquí los exámenes, así que estudiar bastante para estar todos juntos de nuevo el año que viene.
En fin, a lo que íbamos. Al hacer esta práctica nos percatamos de que SWING es un tema muy extenso, por [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=albalba.wordpress.com&blog=2928136&post=98&subd=albalba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Uff la última práctica de swing… NOS AUTO-DAMOS ÁNIMO Y TAMBIÉN LO MANDAMOS A LOS LECTORES!!! Ya están aquí los exámenes, así que estudiar bastante para estar todos juntos de nuevo el año que viene.</span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">En fin, a lo que íbamos. Al hacer esta práctica nos percatamos de que SWING es un tema muy extenso, por esta razón es imposible aprenderse todos los métodos y clases que existen en este campo, que hace cada uno,… en definitiva, ES IMPOSIBLE APRENDER SWING PERFECTAMENTE!! Entonces, intentaremos enterarnos de todo lo que podamos hasta que ya nuestros cerebros digan: “Hasta aquí he llegao’ chabalita.”. </span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">A continuación lo que entendimos y lo que no en esta sesión.</span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Esta práctica trataba básicamente de la programación orientada eventos. Para entenderlo hay que comprender que los medios que teníamos para comunicarnos con un programa no son ágiles, no son adecuados (el manejador de ventana, la entrada estándar, los argumentos,..), por ello se desarrollaron los eventos. </span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Volviendo al tema de los hilos. Los eventos salen del <strong>hilo raiz, main</strong>. El thread main ejecuta el programa. Todos los eventos que se van produciendo entran en una cola de eventos, los cuales salen de uno en uno hacia el hilo bifurcado, llamado <strong>Event-Dispaching Thread</strong>. El event-dispaching thread se activa en cuanto invocas a cualquiera de los métodos setVisible(), show(), o pack(). El hilo que procesa los eventos (event-dispaching thread) trabaja secuencialmente, mientras que el hilo del programa (main) procesa eventos secuencialmente también, pero son distintos. </span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Los eventos no hay que utilizarlos para cualquier cosa. JLabel es pasivo y no necesita un escuchador. En cambio, JButton es activo y sobre él puedo producir un evento el cual será procesado por un objeto actionListener. Hay que añadir un actionListener, uan interfaz, con un método actionPerformed. Tengo un objeto de la clase que implementa actionListener para el botón:</span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">b.addActionListener(o);</span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Para el escuchador o bien:</span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">- creo una clase interna, </span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">- o una clase que lo implemente y mando el objeto.</span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Cuando sea necesario utilizar actionListener, hay que importar java.awt.event;</span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Uno de los errores que cometimos mientras programábamos, fue que queríamos importar este paquete entero con esa sentencia. <strong>ERROR!!!</strong> <em>Recordad que para importar el paquete event entero hay que colocar la sentencia</em> java.awt.event.*; </span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Al principio de la clase programamos una clase en la que se mostrase una ventana con un botón, cada vez se pulsase dicho botón debía aparecer un texto por la salida estándar. Después de habernos peleado con el juego esto fue fácil de hacer. Lo más cómodo para hacer una clase para que aparezca una ventana, es hacer que ésta herede de JFrame. También la hicimos implementar de la clase actionListener, el escuchador para el botón, así se provocar el evento deseado. Como implementamos de actionListener tan sólo hay que escribir un método, el único que tiene, actionPerformed:</span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#92d050;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h2 style="margin:auto 0;"><span style="font-size:10pt;color:black;" lang="EN-GB"><span style="font-family:Times New Roman;">java.awt.event</span></span><span style="color:black;" lang="EN-GB"><span style="font-size:large;"><span style="font-family:Times New Roman;"><br />
Interface ActionListener</span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:black;" lang="EN-GB">All Superinterfaces:</span></strong><span style="color:black;" lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:black;" lang="ES"><a title="interface in java.util" href="http://java.sun.com/javase/6/docs/api/java/util/EventListener.html"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">EventListener</span></span></a></span><span style="color:black;" lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:black;" lang="EN-GB">All Known Subinterfaces:</span></strong><span style="color:black;" lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:black;" lang="ES"><a title="interface in javax.swing" href="http://java.sun.com/javase/6/docs/api/javax/swing/Action.html"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">Action</span></span></a></span><span style="color:black;" lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:black;" lang="EN-GB">All Known Implementing Classes:</span></strong><span style="color:black;" lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:black;" lang="ES"><a title="class in javax.swing" href="http://java.sun.com/javase/6/docs/api/javax/swing/AbstractAction.html"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">AbstractAction</span></span></a></span><span style="font-size:small;"><span style="font-family:Times New Roman;"><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in java.awt" href="http://java.sun.com/javase/6/docs/api/java/awt/AWTEventMulticaster.html"><span lang="EN-GB">AWTEventMulticaster</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicDesktopPaneUI.CloseAction.html"><span lang="EN-GB">BasicDesktopPaneUI.CloseAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicDesktopPaneUI.MaximizeAction.html"><span lang="EN-GB">BasicDesktopPaneUI.MaximizeAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicDesktopPaneUI.MinimizeAction.html"><span lang="EN-GB">BasicDesktopPaneUI.MinimizeAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicDesktopPaneUI.NavigateAction.html"><span lang="EN-GB">BasicDesktopPaneUI.NavigateAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicDesktopPaneUI.OpenAction.html"><span lang="EN-GB">BasicDesktopPaneUI.OpenAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicFileChooserUI.ApproveSelectionAction.html"><span lang="EN-GB">BasicFileChooserUI.ApproveSelectionAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicFileChooserUI.CancelSelectionAction.html"><span lang="EN-GB">BasicFileChooserUI.CancelSelectionAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicFileChooserUI.ChangeToParentDirectoryAction.html"><span lang="EN-GB">BasicFileChooserUI.ChangeToParentDirectoryAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicFileChooserUI.GoHomeAction.html"><span lang="EN-GB">BasicFileChooserUI.GoHomeAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicFileChooserUI.NewFolderAction.html"><span lang="EN-GB">BasicFileChooserUI.NewFolderAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicFileChooserUI.UpdateAction.html"><span lang="EN-GB">BasicFileChooserUI.UpdateAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicInternalFrameTitlePane.CloseAction.html"><span lang="EN-GB">BasicInternalFrameTitlePane.CloseAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicInternalFrameTitlePane.IconifyAction.html"><span lang="EN-GB">BasicInternalFrameTitlePane.IconifyAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicInternalFrameTitlePane.MaximizeAction.html"><span lang="EN-GB">BasicInternalFrameTitlePane.MaximizeAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicInternalFrameTitlePane.MoveAction.html"><span lang="EN-GB">BasicInternalFrameTitlePane.MoveAction</span></a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicInternalFrameTitlePane.RestoreAction.html">BasicInternalFrameTitlePane.RestoreAction</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicInternalFrameTitlePane.SizeAction.html">BasicInternalFrameTitlePane.SizeAction</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicOptionPaneUI.ButtonActionListener.html">BasicOptionPaneUI.ButtonActionListener</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicScrollBarUI.ScrollListener.html">BasicScrollBarUI.ScrollListener</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicSliderUI.ActionScroller.html">BasicSliderUI.ActionScroller</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicSliderUI.ScrollListener.html">BasicSliderUI.ScrollListener</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicSplitPaneUI.KeyboardDownRightHandler.html">BasicSplitPaneUI.KeyboardDownRightHandler</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicSplitPaneUI.KeyboardEndHandler.html">BasicSplitPaneUI.KeyboardEndHandler</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicSplitPaneUI.KeyboardHomeHandler.html">BasicSplitPaneUI.KeyboardHomeHandler</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicSplitPaneUI.KeyboardResizeToggleHandler.html">BasicSplitPaneUI.KeyboardResizeToggleHandler</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicSplitPaneUI.KeyboardUpLeftHandler.html">BasicSplitPaneUI.KeyboardUpLeftHandler</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicTreeUI.ComponentHandler.html">BasicTreeUI.ComponentHandler</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicTreeUI.TreeCancelEditingAction.html">BasicTreeUI.TreeCancelEditingAction</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicTreeUI.TreeHomeAction.html">BasicTreeUI.TreeHomeAction</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicTreeUI.TreeIncrementAction.html">BasicTreeUI.TreeIncrementAction</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicTreeUI.TreePageAction.html">BasicTreeUI.TreePageAction</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicTreeUI.TreeToggleAction.html">BasicTreeUI.TreeToggleAction</a>, <a title="class in javax.swing.plaf.basic" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/basic/BasicTreeUI.TreeTraverseAction.html">BasicTreeUI.TreeTraverseAction</a>, <a title="class in javax.swing" href="http://java.sun.com/javase/6/docs/api/javax/swing/DefaultCellEditor.EditorDelegate.html">DefaultCellEditor.EditorDelegate</a>, <a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/DefaultEditorKit.BeepAction.html">DefaultEditorKit.BeepAction</a>, <a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/DefaultEditorKit.CopyAction.html">DefaultEditorKit.CopyAction</a>, <a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/DefaultEditorKit.CutAction.html">DefaultEditorKit.CutAction</a>, <a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/DefaultEditorKit.DefaultKeyTypedAction.html">DefaultEditorKit.DefaultKeyTypedAction</a>, <a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/DefaultEditorKit.InsertBreakAction.html">DefaultEditorKit.InsertBreakAction</a>, <a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/DefaultEditorKit.InsertContentAction.html">DefaultEditorKit.InsertContentAction</a>, <a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/DefaultEditorKit.InsertTabAction.html">DefaultEditorKit.InsertTabAction</a>, <a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/DefaultEditorKit.PasteAction.html">DefaultEditorKit.PasteAction</a>, <a title="class in javax.swing.tree" href="http://java.sun.com/javase/6/docs/api/javax/swing/tree/DefaultTreeCellEditor.html">DefaultTreeCellEditor</a>, <a title="class in java.awt.dnd" href="http://java.sun.com/javase/6/docs/api/java/awt/dnd/DropTarget.DropTargetAutoScroller.html">DropTarget.DropTargetAutoScroller</a>, <a title="class in javax.swing.text.html" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/html/FormView.html">FormView</a>, <a title="class in javax.swing.text.html" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/html/HTMLEditorKit.HTMLTextAction.html">HTMLEditorKit.HTMLTextAction</a>, <a title="class in javax.swing.text.html" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/html/HTMLEditorKit.InsertHTMLTextAction.html">HTMLEditorKit.InsertHTMLTextAction</a>, <a title="class in javax.swing" href="http://java.sun.com/javase/6/docs/api/javax/swing/JComboBox.html">JComboBox</a>, <a title="class in java.awt" href="http://java.sun.com/javase/6/docs/api/java/awt/List.AccessibleAWTList.html">List.AccessibleAWTList</a>, <a title="class in javax.swing.plaf.metal" href="http://java.sun.com/javase/6/docs/api/javax/swing/plaf/metal/MetalFileChooserUI.DirectoryComboBoxAction.html">MetalFileChooserUI.Directo<span lang="EN-GB">ryComboBoxAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/StyledEditorKit.AlignmentAction.html"><span lang="EN-GB">StyledEditorKit.AlignmentAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/StyledEditorKit.BoldAction.html"><span lang="EN-GB">StyledEditorKit.BoldAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/StyledEditorKit.FontFamilyAction.html"><span lang="EN-GB">StyledEditorKit.FontFamilyAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/StyledEditorKit.FontSizeAction.html"><span lang="EN-GB">StyledEditorKit.FontSizeAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/StyledEditorKit.ForegroundAction.html"><span lang="EN-GB">StyledEditorKit.ForegroundAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/StyledEditorKit.ItalicAction.html"><span lang="EN-GB">StyledEditorKit.ItalicAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/StyledEditorKit.StyledTextAction.html"><span lang="EN-GB">StyledEditorKit.StyledTextAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/StyledEditorKit.UnderlineAction.html"><span lang="EN-GB">StyledEditorKit.UnderlineAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/TextAction.html"><span lang="EN-GB">TextAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing" href="http://java.sun.com/javase/6/docs/api/javax/swing/ToolTipManager.insideTimerAction.html"><span lang="EN-GB">ToolTipManager.insideTimerAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing" href="http://java.sun.com/javase/6/docs/api/javax/swing/ToolTipManager.outsideTimerAction.html"><span lang="EN-GB">ToolTipManager.outsideTimerAction</span></a></span><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a title="class in javax.swing" href="http://java.sun.com/javase/6/docs/api/javax/swing/ToolTipManager.stillInsideTimerAction.html"><span lang="EN-GB">ToolTipManager.stillInsideTimerAction</span></a></span><span style="color:black;" lang="EN-GB"> </span></span></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span style="color:black;" lang="ES"><span style="font-size:small;font-family:Times New Roman;"><br />
<hr size="2" /></span></span></div>
<pre><span style="color:black;" lang="EN-GB"><span style="font-size:x-small;">public interface <strong>ActionListener</strong></span></span>
<span style="font-size:x-small;"><span style="color:black;" lang="EN-GB">extends </span><span style="color:black;" lang="ES"><a title="interface in java.util" href="http://java.sun.com/javase/6/docs/api/java/util/EventListener.html"><span lang="EN-GB">EventListener</span></a></span><span style="color:black;" lang="EN-GB"></span></span></pre>
<p><span style="color:black;" lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;">The listener interface for receiving action events. The class that is interested in processing an action event implements this interface, and the object created with that class is registered with a component, using the component&#8217;s </span></span><code><span style="font-size:10pt;color:black;" lang="EN-GB">addActionListener</span></code><span style="color:black;" lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> method. When the action event occurs, that object&#8217;s </span></span><code><span style="font-size:10pt;color:black;" lang="EN-GB">actionPerformed</span></code><span style="color:black;" lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"> method is invoked. </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:black;" lang="EN-GB">Since:</span></strong><span style="color:black;" lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:black;" lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">1.1 </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:black;" lang="EN-GB">See Also:</span></strong><span style="color:black;" lang="EN-GB"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:black;" lang="ES"><a title="class in java.awt.event" href="http://java.sun.com/javase/6/docs/api/java/awt/event/ActionEvent.html"><code><span style="font-size:10pt;" lang="EN-GB"><span style="color:#800080;">ActionEvent</span></span></code></a></span><span style="font-size:small;"><span style="font-family:Times New Roman;"><span style="color:black;" lang="EN-GB">, </span><span style="color:black;" lang="ES"><a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/eventmodel.html"><span lang="EN-GB">Tutorial: Java 1.1 Event Model</span></a></span><span style="color:black;" lang="EN-GB"></span></span></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span style="color:black;" lang="ES"><span style="font-size:small;font-family:Times New Roman;"><br />
<hr size="2" /></span></span></div>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;" colspan="2">
<p class="MsoNormal" style="margin:0;"><a name="method_summary"></a><span style="font-family:Times New Roman;"><strong><span style="font-size:18pt;color:black;" lang="EN-GB">Method Summary</span></strong><strong><span style="color:black;" lang="EN-GB"></span></strong></span></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;color:black;" lang="EN-GB"> void</span></code><span style="color:black;" lang="EN-GB"></span></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;color:black;" lang="ES"><a href="http://java.sun.com/javase/6/docs/api/java/awt/event/ActionListener.html#actionPerformed(java.awt.event.ActionEvent)"><span lang="EN-GB">actionPerformed</span></a></span></strong></code><code><span style="font-size:10pt;color:black;" lang="EN-GB">(</span></code><code><span style="font-size:10pt;color:black;" lang="ES"><a title="class in java.awt.event" href="http://java.sun.com/javase/6/docs/api/java/awt/event/ActionEvent.html"><span lang="EN-GB"><span style="color:#800080;">ActionEvent</span></span></a></span></code><code><span style="font-size:10pt;color:black;" lang="EN-GB"> e)</span></code><span style="color:black;" lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;"><br />
          Invoked when an action occurs.</span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p><span style="color:black;" lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">  </span></span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><a name="method_detail"></a><strong><span style="font-family:Times New Roman;"><span style="font-size:18pt;color:black;" lang="ES">Method Detail</span><span style="color:black;" lang="ES"></span></span></strong></p>
</td>
</tr>
</tbody>
</table>
<h3 style="margin:auto 0;"><a name="actionPerformed(java.awt.event.ActionEve"></a><span style="color:black;" lang="ES"><span style="font-size:medium;"><span style="font-family:Times New Roman;">actionPerformed</span></span></span></h3>
<pre><span style="color:black;" lang="ES"><span style="font-size:x-small;">void <strong>actionPerformed</strong>(</span><a title="class in java.awt.event" href="http://java.sun.com/javase/6/docs/api/java/awt/event/ActionEvent.html"><span style="font-size:x-small;color:#800080;">ActionEvent</span></a><span style="font-size:x-small;"> e)</span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:black;" lang="EN-GB"><span style="font-size:small;"><span style="font-family:Times New Roman;">Invoked when an action occurs. </span></span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="EN-GB"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">En el método actionPerformed() escribimos lo que queremos que ocurra cuando pulsemos el botón, en este caso haremos que por la salida estándar se lea: Cotilleando. </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">El profesor nos dijo que si ya teníamos hecho esto, metiésemos hilos en el programa para ver lo que aparecía, por esta razón el Simple00GUI también implementa a la interfaz Runnable. En esta ocasión, no nos quedó más remedio que tirar de la práctica anterior. </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">El resultado final fue el siguiente:</span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Y por pantalla se podía apreciar:</span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Después programamos una clase que presentase una ventana con un botón y una etiqueta, y cuando se pulse el botón, cambiar el color de la etiqueta. Así que, cogimos el programa anterior con un copy paste XD y lo modificamos para lograr el objetivo. Para colocarlo pusimos un GridLayout con dos filas y cero columnas, de tal forma que se colocarían el botón y debajo de él la etiqueta. Tuvimos que modificar el actionPerformed(). En él dejamos la sentencia colocada anteriormente, y añadimos un setBackground, para poner un color de fondo a la etiqueta, y un setOpaque a true. Pero no está muy bien hecho, ya que tan solo cambia de color cuando se pulsa el botón la primera vez, las siguientes veces ya no cambia. No sabemos que hacer para que se nos cambie de color la etiqueta cada vez que se pulse el botón. </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Así nos quedó:</span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">El último programa al que llegamos en esta sesión, fue en el que había que programar una clase que presente lo que se pedía en el ejercicio anterior, pero además, también se cambie de color la etiqueta cada vez que se pulse enter. Esta ya si que no llegamos ni si quiera a que nos compilase. El profe, al ver nuestro código cuando le hicimos una pregunta (bueno, en realidad unas cuantas jeje) nos aconsejó que el constructor tan solo inicializásemos los atributos y la parrafada la colocásemos en otro lado, verdad como un templo, por lo que para hacer esta clase lo pusimos como él nos aconsejó. </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Para solucionar ésto, volvimos a pensar en los dichosos hilos. Debíamos hacer que se ejecutasen en distintas partes la interfaz gráfica y el teclado. Para hacer lo del enter, a última hora de clase se nos desveló el secreto, se hacía con un BufferedReader, como toda la vida. Cuando se haya ejecutado el readLine(), cuando se haya pulsado el enter, en el label se cambiará el color. Esto cambio de color queremos que lo haga el event-dispaching thread, principalmente con el método run(). El hilo main ha estado inactivo hasta ahora. Así, el main lanza los eventos gráficos a la cola de eventos y se procesará donde debe, el event-dispaching thread<span>  </span>procesa los eventos gráficos.</span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Este ejercicio nos resultó bastante “complicaillo”, veremos si ahora que ya tenemos esa “luz”, somos capaces de solucionarlo. </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">YA TAN SOLO QUEDA UNA PRÁCTICA, YUJUUU!!! Digo, uy que penaa!!</span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;">Hasta la siguiente y última compañeros.</span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:12pt;margin:0;"><span lang="ES"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/albalba.wordpress.com/98/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/albalba.wordpress.com/98/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/albalba.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/albalba.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/albalba.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/albalba.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/albalba.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/albalba.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/albalba.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/albalba.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/albalba.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/albalba.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=albalba.wordpress.com&blog=2928136&post=98&subd=albalba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://albalba.wordpress.com/2008/05/27/practica-11/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01d14aa501d23992c6b5343fee709397?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">albalba &#38; rodri</media:title>
		</media:content>
	</item>
		<item>
		<title>Práctica 10</title>
		<link>http://albalba.wordpress.com/2008/05/19/practica-10/</link>
		<comments>http://albalba.wordpress.com/2008/05/19/practica-10/#comments</comments>
		<pubDate>Mon, 19 May 2008 16:31:35 +0000</pubDate>
		<dc:creator>albalba</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://albalba.wordpress.com/?p=97</guid>
		<description><![CDATA[Hola!! Sentimos habernos atrasado un poco…pero ya se acercan los exámenes y entre prácticas, el estudio, el agobio,… todo se junta. Aunque no os preocupéis, porque dentro de poco vendrá el día 1 de julio, ya veréis que está a la vuelta de la esquina. 
Pues bien, la mañana en la que hicimos esta práctica [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=albalba.wordpress.com&blog=2928136&post=97&subd=albalba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Hola!! Sentimos habernos atrasado un poco…pero ya se acercan los exámenes y entre prácticas, el estudio, el agobio,… todo se junta. Aunque no os preocupéis, porque dentro de poco vendrá el día 1 de julio, ya veréis que está a la vuelta de la esquina. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Pues bien, la mañana en la que hicimos esta práctica se comentó que era una práctica importante, </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Lo primero sobre lo que hablamos fue de los procesos. Acto seguido escribiremos lo que entendimos sobre lo que se dijo en clase. En el administrador de tareas se ven los procesos de un ordenador. Los programas necesitan procesos para funcionar. Un programa, en realidad, no se diferencia en nada de un proceso, son lo mismo. Son líneas de código compilado que se está ejecutando. Si tenemos 50 procesos, por ejemplo, ejecutándose en un pc, en realidad no están ejecutándose a la vez. En un sistema operativo multitarea tengo muchos procesos. Entonces nos surgió la duda, ¿es posible ejecutar 5 procesos al mismo tiempo? No, tan solo ejecuta un proceso en cada momento, pero los ordenadores trabajan en milisegundos, por lo que ni notamos que van de uno en uno. Tenemos 5 procesos pero se ejecuta uno cada vez. Un ejemplo es el antivirus, está ejecutando el rastreo del ordenata pero también lo hace si se cierra la ventana.</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Después, comenzamos analizando el código de la clase Ding, bastante sencillo. Lo compilamos y ejecutamos. Cada vez que le des al enter, aparece por pantalla el mensaje DING! Realizamos la misma operación con la clase Dong, es decir, compilamos y ejecutamos. Con este programita, cada segundo se imprimía DONG! por pantalla. A la hora de entender el código de este ya tuvimos<span>  </span>que tirar del API porque no sabíamos que significaba la línea: Thread.sleep(1000); Buscamos la palabra thread, y su significado era hilo. Apareció lo siguiente sobre Thread en el API:</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#99cc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h2 style="margin:auto 0;"><span style="font-size:10pt;color:#000000;"><span style="font-family:Times New Roman;">java.lang</span></span><span style="color:#000000;"><span style="font-size:large;"><span style="font-family:Times New Roman;"><br />
Class Thread</span></span></span></h2>
<pre><span style="color:#000000;"><a title="class in java.lang" href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html"><span><span style="font-size:x-small;">java.lang.Object</span></span></a></span>
<span style="color:#000000;"><span><span style="font-size:x-small;">  </span></span></span><span style="font-size:x-small;"><strong><span style="color:#000000;">java.lang.Thread</span></strong></span></pre>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">All Implemented Interfaces:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><a title="interface in java.lang" href="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html"><span style="font-size:small;font-family:Times New Roman;">Runnable</span></a><span style="font-size:small;"><span style="font-family:Times New Roman;"> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<pre><span style="color:#000000;"><span style="font-size:x-small;">public class <strong>Thread</strong></span></span>
<span style="font-size:x-small;"><span style="color:#000000;">extends </span><span style="color:#000000;"><a title="class in java.lang" href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html"><span>Object</span></a></span></span>
<span style="font-size:x-small;"><span style="color:#000000;">implements </span><span style="color:#000000;"><a title="interface in java.lang" href="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html"><span>Runnable</span></a></span></span></pre>
<p><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">A <em>thread</em> is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently. </span></span></span></p>
<p><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">Every thread has a priority. Threads with higher priority are executed in preference to threads with lower priority. Each thread may or may not also be marked as a daemon. When code running in some thread creates a new </span></span><code><span style="font-size:10pt;color:#000000;">Thread</span></code><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;"> object, the new thread has its priority initially set equal to the priority of the creating thread, and is a daemon thread if and only if the creating thread is a daemon. </span></span></span></p>
<p><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">When a Java Virtual Machine starts up, there is usually a single non-daemon thread (which typically calls the method named </span></span><code><span style="font-size:10pt;color:#000000;">main</span></code><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;"> of some designated class). The Java Virtual Machine continues to execute threads until either of the following occurs: </span></span></span></p>
<ul type="disc">
<li class="MsoNormal"><span><span style="font-size:small;font-family:Times New Roman;">The </span></span><code><span style="font-size:10pt;">exit</span></code><span><span style="font-size:small;font-family:Times New Roman;"> method of class </span></span><code><span style="font-size:10pt;">Runtime</span></code><span><span style="font-size:small;"><span style="font-family:Times New Roman;"> has been called and the security manager has permitted the exit operation to take place. </span></span></span></li>
<li class="MsoNormal"><span><span style="font-size:small;font-family:Times New Roman;">All threads that are not daemon threads have died, either by returning from the call to the </span></span><code><span style="font-size:10pt;">run</span></code><span><span style="font-size:small;font-family:Times New Roman;"> method or by throwing an exception that propagates beyond the </span></span><code><span style="font-size:10pt;">run</span></code><span><span style="font-size:small;"><span style="font-family:Times New Roman;"> method. </span></span></span></li>
</ul>
<p><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">There are two ways to create a new thread of execution. One is to declare a class to be a subclass of </span></span><code><span style="font-size:10pt;color:#000000;">Thread</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">. This subclass should override the </span></span><code><span style="font-size:10pt;color:#000000;">run</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> method of class </span></span><code><span style="font-size:10pt;color:#000000;">Thread</span></code><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">. An instance of the subclass can then be allocated and started. For example, a thread that computes primes larger than a stated value could be written as follows: </span></span></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"></p>
<hr size="2" /></span></span></div>
<pre><span style="color:#000000;"><span style="font-size:x-small;"><span>     </span>class PrimeThread extends Thread {</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>         </span>long minPrime;</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>         </span>PrimeThread(long minPrime) {</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>             </span>this.minPrime = minPrime;</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>      </span><span>   </span>}</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"> </span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>         </span>public void run() {</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>             </span>// compute primes larger than minPrime</span></span>
<span style="font-size:x-small;"><span style="color:#000000;"><span>             </span> </span><span style="color:#000000;">. . .</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>         </span>}</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>     </span>}</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"> </span></span></pre>
<div class="MsoNormal" style="text-align:center;margin:0;"><span style="color:#000000;"><span style="font-size:x-small;"></p>
<hr size="2" /></span></span></div>
<p><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">The following code would then create a thread and start it running: </span></span></span></p>
<pre><span style="color:#000000;"><span style="font-size:x-small;"><span>     </span>PrimeThread p = new PrimeThread(143);</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>     </span>p.start();</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"> </span></span></pre>
<p><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">The other way to create a thread is to declare a class that implements the </span></span><code><span style="font-size:10pt;color:#000000;">Runnable</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> interface. That class then implements the </span></span><code><span style="font-size:10pt;color:#000000;">run</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> method. An instance of the class can then be allocated, passed as an argument when creating </span></span><code><span style="font-size:10pt;color:#000000;">Thread</span></code><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">, and started. The same example in this other style looks like the following: </span></span></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"></p>
<hr size="2" /></span></span></div>
<pre><span style="color:#000000;"><span style="font-size:x-small;"><span>     </span>class PrimeRun implements Runnable {</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>         </span>long minPrime;</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>         </span>PrimeRun(long minPrime) {</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>             </span>this.minPrime = minPrime;</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>         </span>}</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"> </span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>         </span>public void run() {</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>             </span>// compute primes larger than minPrime</span></span>
<span style="font-size:x-small;"><span style="color:#000000;"><span>             </span> </span><span style="color:#000000;">. . .</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>         </span>}</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>     </span>}</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"> </span></span></pre>
<div class="MsoNormal" style="text-align:center;margin:0;"><span style="color:#000000;"><span style="font-size:x-small;"></p>
<hr size="2" /></span></span></div>
<p><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">The following code would then create a thread and start it running: </span></span></span></p>
<pre><span style="color:#000000;"><span style="font-size:x-small;"><span>     </span>PrimeRun p = new PrimeRun(143);</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"><span>     </span>new Thread(p).start();</span></span>
<span style="color:#000000;"><span style="font-size:x-small;"> </span></span></pre>
<p><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">Every thread has a name for identification purposes. More than one thread may have the same name. If a name is not specified when a thread is created, a new name is generated for it. </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">Since:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">JDK1.0 </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">See Also:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><a title="interface in java.lang" href="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html"><code><span style="font-size:10pt;">Runnable</span></code></a></span><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span style="color:#000000;"><a href="http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exit(int)"><code><span style="font-size:10pt;">Runtime.exit(int)</span></code></a></span><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span style="color:#000000;"><a href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#run()"><code><span style="font-size:10pt;">run()</span></code></a></span><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span style="color:#000000;"><a href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#stop()"><code><span style="font-size:10pt;">stop()</span></code></a></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span><span style="font-size:small;font-family:Times New Roman;">  </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Nos quedó claro que Thread y Runnable iban dadas de la mano, pero eso lo miraremos más adelante. Ahora había que averiguar cuál era la función del método sleep. </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#99cc00;border-collapse:collapse;margin:auto auto auto 36pt;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h3 style="margin:12pt 0 3pt;"><span style="color:#000000;"><span style="font-size:medium;"><span style="font-family:Arial;">sleep</span></span></span></h3>
<pre><span style="font-size:x-small;"><span style="color:#000000;">public static void <strong>sleep</strong>(long millis)throws </span><span style="color:#000000;"><a title="class in java.lang" href="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html"><span>InterruptedException</span></a></span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers. The thread does not lose ownership of any monitors. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">Parameters:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><code><span style="font-size:10pt;color:#000000;">millis</span></code><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;"> &#8211; the length of time to sleep in milliseconds. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">Throws:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><code><span style="font-size:10pt;color:#000000;"><a title="class in java.lang" href="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html"><span>InterruptedException</span></a></span></code><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;"> &#8211; if any thread has interrupted the current thread. The <em>interrupted status</em> of the current thread is cleared when this exception is thrown. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">See Also:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="color:#000000;"><a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html#notify()"><code><span style="font-size:10pt;">Object.notify()</span></code></a></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Entonces entendimos porque aparecía un 1000 como parámetro, había que pasarle por parámetro el tiempo que quieres que cese la ejecución del hilo en términos de milisegundos, y como todos sabemos, un segundo son 1000 milisegundos. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Y pensamos, ¿por qué llama al método directamente colocando el nombre de la clase en lugar de llamarlo con un objeto? Esto se puede hacer porque dicho método es static. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Seguimos con la clase DingDongPoor, la cual probamos y no funcionaba de acuerdo con lo esperado. Esperábamos que cada segundo saliese DONG! y que cada vez que pulsábamos el enter dijese DING! Pero no. Pulsábamos el enter y aparecía </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">DONG! </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">DING! </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">DONG! </span></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">y esperaba a que el usuario volviese a dar al enter, sino no hacía nada. Parece ser que no podía hacer las dos cosas al mismo tiempo. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Hay sistemas operativos que establecen prioridades en los distintos procesos como Linux. Se pueden tener dos hilos de ejecución asociados al mismo proceso. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Para hacer que DING! y DONG! se ejecuten a la vez hay que tener en cuenta lo siguiente. Se puede resolver este problema de dos maneras. Una es implementando la internaz Runnable en la clase principal, y la otra es mediante la clase interna Runnable. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Existe una interfaz llamada Runnable que tan solo tiene el método public void run( ), y se crean instancias de él como Runnable r = new Runnable( ); </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#99cc00;border-collapse:collapse;margin:auto auto auto 36pt;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h2 style="margin:auto 0;"><span style="font-size:10pt;color:#000000;"><span style="font-family:Times New Roman;">java.lang</span></span><span style="color:#000000;"><span style="font-size:large;"><span style="font-family:Times New Roman;"><br />
Interface Runnable</span></span></span></h2>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">All Known Subinterfaces:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><a title="interface in java.util.concurrent" href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/RunnableFuture.html"><span><span style="font-size:small;font-family:Times New Roman;">RunnableFuture</span></span></a></span><span style="font-size:small;"><span style="font-family:Times New Roman;"><span style="color:#000000;">&lt;V&gt;, </span><span style="color:#000000;"><a title="interface in java.util.concurrent" href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/RunnableScheduledFuture.html"><span>RunnableScheduledFuture</span></a></span><span style="color:#000000;">&lt;V&gt; </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">All Known Implementing Classes:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><a title="class in javax.swing.text" href="http://java.sun.com/javase/6/docs/api/javax/swing/text/AsyncBoxView.ChildState.html"><span><span style="font-size:small;font-family:Times New Roman;">AsyncBoxView.ChildState</span></span></a></span><span style="font-size:small;"><span style="font-family:Times New Roman;"><span style="color:#000000;">, </span><span style="color:#000000;"><a title="class in java.util.concurrent" href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/FutureTask.html"><span>FutureTask</span></a></span><span style="color:#000000;">, </span><span style="color:#000000;"><a title="class in java.awt.image.renderable" href="http://java.sun.com/javase/6/docs/api/java/awt/image/renderable/RenderableImageProducer.html"><span>RenderableImageProducer</span></a></span><span style="color:#000000;">, </span><span style="color:#000000;"><a title="class in javax.swing" href="http://java.sun.com/javase/6/docs/api/javax/swing/SwingWorker.html"><span>SwingWorker</span></a></span><span style="color:#000000;">, </span><span style="color:#000000;"><a title="class in java.lang" href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html"><span>Thread</span></a></span><span style="color:#000000;">, </span><span style="color:#000000;"><a title="class in java.util" href="http://java.sun.com/javase/6/docs/api/java/util/TimerTask.html"><span>TimerTask</span></a></span><span style="color:#000000;"> </span></span></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"></p>
<hr size="2" /></span></span></div>
<pre><span style="color:#000000;"><span style="font-size:x-small;">public interface <strong>Runnable</strong></span></span></pre>
<p><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">The </span></span><code><span style="font-size:10pt;color:#000000;">Runnable</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> interface should be implemented by any class whose instances are intended to be executed by a thread. The class must define a method of no arguments called </span></span><code><span style="font-size:10pt;color:#000000;">run</span></code><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">This interface is designed to provide a common protocol for objects that wish to execute code while they are active. For example, </span></span><code><span style="font-size:10pt;color:#000000;">Runnable</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> is implemented by class </span></span><code><span style="font-size:10pt;color:#000000;">Thread</span></code><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">. Being active simply means that a thread has been started and has not yet been stopped. </span></span></span></p>
<p><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">In addition, </span></span><code><span style="font-size:10pt;color:#000000;">Runnable</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> provides the means for a class to be active while not subclassing </span></span><code><span style="font-size:10pt;color:#000000;">Thread</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">. A class that implements </span></span><code><span style="font-size:10pt;color:#000000;">Runnable</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> can run without subclassing </span></span><code><span style="font-size:10pt;color:#000000;">Thread</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> by instantiating a </span></span><code><span style="font-size:10pt;color:#000000;">Thread</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> instance and passing itself in as the target. In most cases, the </span></span><code><span style="font-size:10pt;color:#000000;">Runnable</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> interface should be used if you are only planning to override the </span></span><code><span style="font-size:10pt;color:#000000;">run()</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> method and no other </span></span><code><span style="font-size:10pt;color:#000000;">Thread</span></code><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;"> methods. This is important because classes should not be subclassed unless the programmer intends on modifying or enhancing the fundamental behavior of the class. </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">Since:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">JDK1.0 </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">See Also:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><a title="class in java.lang" href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html"><code><span style="font-size:10pt;">Thread</span></code></a></span><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">, </span></span><span style="color:#000000;"><a title="interface in java.util.concurrent" href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html"><code><span style="font-size:10pt;">Callable</span></code></a></span></p>
<div class="MsoNormal" style="text-align:center;margin:0;"><span style="color:#000000;"></p>
<hr size="2" /></span></div>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;" colspan="2">
<p class="MsoNormal" style="margin:0;"><a name="method_summary"></a><strong><span style="font-family:Times New Roman;"><span style="font-size:18pt;color:#000000;">Method Summary</span></span></strong></p>
</td>
</tr>
<tr>
<td style="background:white;width:1%;border:#ffffff;padding:2.25pt;" width="1%" valign="top">
<p class="MsoNormal" style="text-align:right;margin:0;" align="right"><code><span style="font-size:10pt;color:#000000;"> void</span></code></p>
</td>
<td style="background:white;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><code><strong><span style="font-size:10pt;color:#000000;"><a href="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html#run()"><span>run</span></a></span></strong></code><code><span style="font-size:10pt;color:#000000;">()</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"><br />
          When an object implementing interface </span></span><code><span style="font-size:10pt;color:#000000;">Runnable</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> is used to create a thread, starting the thread causes the object&#8217;s </span></span><code><span style="font-size:10pt;color:#000000;">run</span></code><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;"> method to be called in that separately executing thread.</span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">  </span></span></span></p>
<table class="MsoNormalTable" style="width:100%;" border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td style="background:#ccccff;border:#ffffff;padding:2.25pt;">
<p class="MsoNormal" style="margin:0;"><a name="method_detail"></a><strong><span style="font-family:Times New Roman;"><span style="font-size:18pt;color:#000000;">Method Detail</span></span></strong></p>
</td>
</tr>
</tbody>
</table>
<h3 style="margin:12pt 0 3pt;"><a name="run()"></a><span style="color:#000000;"><span style="font-size:medium;"><span style="font-family:Arial;">run</span></span></span></h3>
<pre><span style="color:#000000;"><span style="font-size:x-small;">void <strong>run</strong>()</span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">When an object implementing interface </span></span><code><span style="font-size:10pt;color:#000000;">Runnable</span></code><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> is used to create a thread, starting the thread causes the object&#8217;s </span></span><code><span style="font-size:10pt;color:#000000;">run</span></code><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;"> method to be called in that separately executing thread. </span></span></span></p>
<p style="margin-left:36pt;"><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;">The general contract of the method </span></span><code><span style="font-size:10pt;color:#000000;">run</span></code><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;"> is that it may take any action whatsoever. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">See Also:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><a href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#run()"><code><span style="font-size:10pt;">Thread.run()</span></code></a></span></p>
<p class="MsoNormal" style="margin:0;"><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">De la primera manera, es crear una clase interna Runnable en la clase principal. Desde fuera de la clase no se ve, a no ser que sea un atributo public. r es un objeto más. Thread es el encargado de hacer la bifurcación. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Thread t = new Thread (r);</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Ahora tenemos un hilo, que en principio no se ha lanzado, relacionado con un Runnable. Si hacemos t.start(); el código que se ejecuta es el método run. start hace dos tareas: 1- crea un thread (hilo) a parte, y 2- llama a run. Cuando start acaba, se acaba el hilo de ejecución. La raíz se puede hacer que funcione y matar la bifurcación, pero no al revés.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">De la otra manera, dentro de la clase principal sobrescribo el método run porque implementa la interfaz Runnable. Comparada con la otra es la forma más cómoda. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#ffc000;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;">public class Fulanita implements Runnable{</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;"><span>   </span></span><span style="font-size:9pt;">start(); //la bifurcación la hace start</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;"><span>   </span></span><span style="font-size:9pt;">run(); //tengo que implementarla</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;">}</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;">Luego en el main hago un start. Si dentro de Fulanita hago:</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;">Thread t = new Thread (r);</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;">t.run();</span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">sólo funciona por el hilo raíz, no por la bifurcación. Un ejemplo es, que aunque cierres la ventana, sigue ejecutando el programa, de los dos hilos uno está vivo.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Esto último es lo que hace la clase TwoThreadsSimple.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Ahora desglosaremos la clase TwoThreads. Se crea un método static que no devuelve nada llamado PrintThreadName. Se invoca la método currentThread() y getName() de la clase Thread:</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#99cc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:black 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h3 style="margin:12pt 0 3pt;"><span style="color:#000000;"><span style="font-size:medium;"><span style="font-family:Arial;">currentThread</span></span></span></h3>
<pre><span style="font-size:x-small;"><span style="color:#000000;">public static </span><span style="color:#000000;"><a title="class in java.lang" href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html"><span>Thread</span></a></span><span style="color:#000000;"> </span><strong><span style="color:#000000;">currentThread</span></strong><span style="color:#000000;">()</span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">Returns a reference to the currently executing thread object. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">Returns:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">the currently executing thread.</span></span></span></p>
<h3 style="margin:12pt 0 3pt;"><span style="color:#000000;"><span style="font-size:medium;font-family:Arial;"> </span></span></h3>
<h3 style="margin:12pt 0 3pt;"><span style="color:#000000;"><span style="font-size:medium;"><span style="font-family:Arial;">getName</span></span></span></h3>
<pre><span style="font-size:x-small;"><span style="color:#000000;">public final </span><span style="color:#000000;"><a title="class in java.lang" href="http://java.sun.com/javase/6/docs/api/java/lang/String.html"><span><span style="color:#800080;">String</span></span></a></span><span style="color:#000000;"> </span><strong><span style="color:#000000;">getName</span></strong><span style="color:#000000;">()</span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">Returns this thread&#8217;s name. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">Returns:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><span style="font-size:small;"><span style="font-family:Times New Roman;">this thread&#8217;s name. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span style="color:#000000;">See Also:</span></strong><span style="color:#000000;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="color:#000000;"><a href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#setName(java.lang.String)"><code><span style="font-size:10pt;">setName(String)</span></code></a></span></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Entonces en: </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span style="color:#000000;">Thread.currentThread() , </span><span>currentThread devuelve la referencia del hilo que se está ejecutando, y</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span style="color:#000000;">Thread.currentThread().getName() , </span><span>getName devuelve un String con el nombre del hilo que se está ejecutando, la referencia del hilo que devuelve currentThread. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">El siguiente método es el main, el cual todos muy bien conocemos, en el que se crea un objeto del tipo Runnable. Implementamos el único método de dicha interfaz, run, invocando al método anteriormente descrito, el PrintThreadName.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<pre style="background:#ff9900;margin-left:18pt;"><span style="font-size:x-small;"><span><span> </span></span><span style="color:#000000;">public static void main(String args[]) {</span></span></pre>
<pre style="background:#ff9900;margin-left:18pt;"><span style="font-size:x-small;"><span style="color:#000000;"><span>        </span></span><span style="color:#000000;">Runnable r = new Runnable() {</span></span></pre>
<pre style="background:#ff9900;margin-left:18pt;"><span style="color:#000000;"><span style="font-size:x-small;"><span>            </span>public void run() {</span></span></pre>
<pre style="background:#ff9900;margin-left:18pt;"><span style="color:#000000;"><span style="font-size:x-small;"><span>                </span>PrintThreadName();</span></span></pre>
<pre style="background:#ff9900;margin-left:18pt;"><span style="color:#000000;"><span style="font-size:x-small;"><span>            </span>}</span></span></pre>
<pre style="background:#ff9900;margin-left:18pt;"><span style="color:#000000;"><span style="font-size:x-small;"><span>        </span>};</span></span></pre>
<pre style="background:#ff9900;margin-left:18pt;"><span style="color:#000000;"><span style="font-size:x-small;"> </span></span></pre>
<pre style="background:#ff9900;margin-left:18pt;"><span style="color:#000000;"><span style="font-size:x-small;"><span>        </span>Thread t = new Thread(r);</span></span></pre>
<pre style="background:#ff9900;margin-left:18pt;"><span style="font-size:x-small;"><span style="color:#000000;"><span>        </span></span><span style="color:#000000;">t.start();</span></span></pre>
<pre style="background:#ff9900;margin-left:18pt;"><span style="color:#000000;"><span style="font-size:x-small;"> </span></span></pre>
<pre style="background:#ff9900;margin-left:18pt;"><span style="color:#000000;"><span style="font-size:x-small;"><span>        </span>PrintThreadName();</span></span></pre>
<pre style="background:#ff9900;margin-left:18pt;"><span style="color:#000000;"><span style="font-size:x-small;"><span>  </span>}</span></span></pre>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Acto seguido, se crea un hilo t relacionado con un Runnable, y después lo ejecutamos con el t.start( ). </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Al ejecutar salen dos resultados:</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">main</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Thread-0</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">esos son los dos threads que lanza. El método PrintThreadName se imprime ahora en el main, se declara un Runnable r, que llama al método PrintTrheadName. Una vez que le dices que es lo que tiene que hacer, se crea un hilo hacia ese Runnable y lo inicia. Como resultado este imprimirá el proceso del Runnable. Creemos que como el main es otro Runnable, como llama al método PrintThreadName, simplemente imprime el que esta en ese momento ejecutándose.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Volviendo a la clase TwoThreadSimple, este realiza la misma función que TwoThread. La diferencia es que TwoThread realiza las operaciones colocando una clase interna, Runnable. En cambio, TwoThreadSimple, realiza las operaciones implementando la interfaz Runnable. Hacen lo mismo pero de dos maneras distintas. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Otra forma, es como la que se hace en el programa TwoThreadSimple2, en la que se hereda de la clase Thread, y no crear un objeto del tipo Thread. El resultado por tanto es el mismo que en los otros dos TwoThread.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Continuando con la práctica, nos encontramos con las condiciones de carrera. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Si tenemos, por ejemplo, un fichero compartido entre varios hilos, ¿cuándo abro el fichero? Este es uno de los tantos conflictos que surgen cuando dos hilos intentan acceder a lo mismo, a un recurso compartido, a la vez. No sabemos cuál se va a ejecutar primero. Es un problema. A esto se le llama condición de carrera (Race Condition). Estrictamente se ejecutan por turnos, pero no sabemos cuál lo hará primero y cuál después. Para evitar esto, se le da un tiempo de espera, un sleep(), pero esta solución no vale. Siempre que se pueda hay que evitar el recurso compartido, evitar que los dos threads accedan a la salida estándar.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Esto se comprueba ejecutando el programa RaceCondition. Pensábamos que este programa imprimiría 10.000 ceros y seguido 10.000 unos, o al revés , pero no ocurrió así. Tanto unos como ceros aparecían mezclados a su libre albedrío, y juntos y revueltos. Cada vez que ejecutábamos el programa aparecían revueltos de maneras diferentes. Era como si se estuviesen riendo de nosotros los muy gamberros jeje. Aunque no lo hacían aposta. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Una solución es hacer que el programa principal chequea el estado del programa, y otro programa que ejecute el estado del programa. Vaya trabalenguas eh.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Se podría colocar como recurso compartido, también, una cola de eventos. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Si compilamos y ejecutamos la clase RaceConditionSolved, veréis como los problemas desaparecen, y no es un anuncio de la tele ¡qué va! Con él salen los 10000 ceros y los 10000 unos sin mezclarse entre ellos.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Y hasta aquí llegamos. Esta clase se nos hizo un poco espesa. No había que programar nada pero si entender muchos conceptos nuevos. Además tuvimos que mirar mucho el API, lo malo es que tardamos en traducir lo que dice y entenderlo. Pero seguiremos en nuestro empeño de algún día aprender inglés XD.</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">HASTA LA PRÁCTICA 11!!</span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">PD: Esta semana por cuestion de tiempo no hemos puesto las imágnes de las ejecuciones y más cosas que es habitual.</span></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/albalba.wordpress.com/97/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/albalba.wordpress.com/97/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/albalba.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/albalba.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/albalba.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/albalba.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/albalba.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/albalba.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/albalba.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/albalba.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/albalba.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/albalba.wordpress.com/97/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=albalba.wordpress.com&blog=2928136&post=97&subd=albalba&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://albalba.wordpress.com/2008/05/19/practica-10/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01d14aa501d23992c6b5343fee709397?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">albalba &#38; rodri</media:title>
		</media:content>
	</item>
		<item>
		<title>Práctica 9</title>
		<link>http://albalba.wordpress.com/2008/05/05/practica-9/</link>
		<comments>http://albalba.wordpress.com/2008/05/05/practica-9/#comments</comments>
		<pubDate>Mon, 05 May 2008 09:26:24 +0000</pubDate>
		<dc:creator>albalba</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[alba uc3m]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[JFrame]]></category>
		<category><![CDATA[JLabel]]></category>
		<category><![CDATA[JPanel]]></category>
		<category><![CDATA[oca uc3m]]></category>
		<category><![CDATA[p9]]></category>
		<category><![CDATA[p9 uc3m]]></category>
		<category><![CDATA[práctica9]]></category>
		<category><![CDATA[rodrigo uc3m]]></category>

		<guid isPermaLink="false">http://albalba.wordpress.com/?p=82</guid>
		<description><![CDATA[Hola a todos. Llegados a este punto empieza lo más complicado de la asignatura. 
Se comenzó la clase con un profesor nuevo que de ahora en adelante nos dará las 5 prácticas restantes que quedan. 
A parte de lo que se explicaba en la práctica, hubo que dejar conceptos claros antes de nada, como el [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=albalba.wordpress.com&blog=2928136&post=82&subd=albalba&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/05/helloworldgui.jpg"></a><a href="http://albalba.files.wordpress.com/2008/05/compasssimple2.jpg"></a><a href="http://albalba.files.wordpress.com/2008/05/layoutmanagershow_.jpg"></a>Hola a todos. Llegados a este punto empieza lo más complicado de la asignatura. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Se comenzó la clase con un profesor nuevo que de ahora en adelante nos dará las 5 prácticas restantes que quedan. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">A parte de lo que se explicaba en la práctica, hubo que dejar conceptos claros antes de nada, como el de que GUI (Interfaces Gráficas de Usuario) es una forma de comunicarse con el usuario. La comunicación puede ser gráfica, textual, sonora,… la definición de que salen imágenes por pantalla es errónea. El programa se comunica con el usuario de diferentes formas entonces: mediante texto (entrada y salida estándar), mediante sonido, o con un interfaz gráfico.</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">También nos pareció interesante la explicación sobre el comienzo de las interfaces gráficas y AWT. En definitiva, que todos los componentes de swing J(algo), ese (algo) tienen su correspondiente en AWT.</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;"><span> </span></span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Comenzamos la práctica algo “acongojaillos”, pero por lo menos lo que hicimos en clase no fue tan mal. Ahora trataremos cómo nos fue con el primer ejercicio. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Nos encontramos con la clase HelloWorldGUI. De buenas a primeras no sabíamos muy bien con que nos íbamos a encontrar, por lo que compilamos y ejecutamos dicho código, entonces comprendimos mejor que hacía cada línea. Pero explicar cada línea lo piden más adelante, por lo que, SEGUID LEYENDO!! </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Después enumeramos los nombres de las clases de los objetos que se crean en la ejecución de este programa. Era sencillo observar que se creaba un objeto JLabel, un JFrame y un JPanel. Acto seguido, enumeramos los métodos que se invocan en la ejecución de este programa. El primero, y el principal era el método main, el constructor de JFrame (perteneciente a la clase JFrame, obviamente), el setDefaultCloseOperation() lo llama un objeto JFrame, el getContentePane requiere de una JPanel, el método add() pertenece a la clase JPanel (como JPanel es de tipo contenedor, entonces al llamar al add() añadimos métodos al contenedor), y por último setSize() y setVisible() corresponden a la clase Window.</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">A la hora de decir a que clase pertenecía cada método patinamos bastante. A partir del getContentPane() ya nos costó más verlo, aunque era de cajón. Las que nos asombramos bastante fueron los dos últimos métodos, nosotros pensábamos que serían de la clase JFrame ya que se invocaban con un objeto de ese tipo, pero no. Miramos en el API y efectivamente pertenecían a la clase Window, son métodos que heredan de la clase java.awt.Component. No hace falta importarla porque Window hereda de java.awt.Container, ésta de java.awt.Component, y ésta de java.lang.Object. Como todos los objetos heredan de la clase Object, no es necesario importarla.</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Escuchando al profesor, y acordándonos de lo que nos dijo Alberto, entendimos que para aprender a programar debíamos saber inglés. Así que comenzamos a leer el código observando lo que nos acababa de aparecer. Frame significa marco, entonces la primera línea, ERA PARA DARLE NOMBRE AL MARCO DE LA VENTANA Y DIBUJAR LA VENTANA. Al crearse un JFrame ya se crea un panel por defecto. La segunda línea llama al método setDefaultCloseOperation() mediante el objeto JFrame de la primera línea. Como parámetro del método setDefaultCloseOperation(), se pasa un atributo que está en JFrame (ya que no hace falta un objeto para su invocación y no lleva paréntesis, deducimos que era un atributo), EXIT_ON_CLOSE. Éste, por lo general, es un entero y tiene como modificador static final (la pista es que está escrito en mayúsculas). La finalidad de esta sentencia es la acción sobre la ventana de cerrar<span>  </span>la ventana cuando se da a la aspa. Hay otras formas de cerrar ventanas, por ejemplo, que aparezca otra ventana preguntando si de verdad de la buena deseas cerrar la ventana, o cierras la ventana y se minimiza a un lado como el Messenger. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">En la tercera línea creamos un objeto JPanel. Aquí se extrae, se obtiene, un contentPane. El getContentPane() dice al JFrame:”oyeeeeeeee, se que tienes un JPanel con un contentPane, andaaaaaa pirataaaaaa devuélvelo.”. El JFrame representa la ventana (hereda de Window) y JPanel es algo relacionado con un contenedor (hereda de Container). Esta línea nos costó bastante verla. Nos fuimos al API, a ver en la clase JFrame:</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></strong></p>
<table class="MsoTableGrid" style="background:#99cc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span><span style="font-size:small;"><span style="font-family:Times New Roman;">javax.swing<br />
Class JFrame</span></span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><a title="class in java.lang" href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html"><span><span style="font-size:small;font-family:Times New Roman;">java.lang.Object</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span><span>  </span></span></span></span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html"><span><span style="font-size:small;font-family:Times New Roman;">java.awt.Component</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span><span style="font-size:small;font-family:Times New Roman;">      </span></span></span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Container.html"><span><span style="font-size:small;font-family:Times New Roman;">java.awt.Container</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span><span style="font-size:small;font-family:Times New Roman;">          </span></span></span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Window.html"><span><span style="font-size:small;font-family:Times New Roman;">java.awt.Window</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span><span style="font-size:small;font-family:Times New Roman;">              </span></span></span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Frame.html"><span><span style="font-size:small;font-family:Times New Roman;">java.awt.Frame</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span><span style="font-size:small;font-family:Times New Roman;">                  </span></span></span><strong><span style="font-size:small;font-family:Times New Roman;">javax.swing.JFrame</span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">el método getContentPane():</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span><span style="font-size:small;"><span style="font-family:Times New Roman;">getContentPane</span></span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">public </span></span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Container.html"><span><span style="font-size:small;font-family:Times New Roman;">Container</span></span></a><span><span style="font-size:small;"><span style="font-family:Times New Roman;"> <strong>getContentPane</strong>()</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Returns the contentPane object for this frame. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Specified by:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/RootPaneContainer.html#getContentPane()"><span><span style="font-size:small;font-family:Times New Roman;">getContentPane</span></span></a><span><span style="font-size:small;font-family:Times New Roman;"> in interface </span></span><a title="interface in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/RootPaneContainer.html"><span><span style="font-size:small;font-family:Times New Roman;">RootPaneContainer</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Returns:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">the contentPane property </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>See Also:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JFrame.html#setContentPane(java.awt.Container)"><span><span style="font-size:small;font-family:Times New Roman;">setContentPane(java.awt.Container)</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/RootPaneContainer.html#getContentPane()"><span><span style="font-size:small;font-family:Times New Roman;">RootPaneContainer.getContentPane()</span></span></a></p>
<p class="MsoNormal" style="margin:0;"><strong><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></strong></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">por lo que, se devuelve el panel que contiene el JFrame, pero en un objeto de la clase Container. Como Container es superclase de la clase JPanel, entonces hay que hacer un casting para convertirlo en un objeto tipo JPanel.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">En la siguiente sentencia buscamos en el diccionario label, cuyo significado es etiqueta. Creamos una instancia de JLabel mediante el constructor y lo inicializamos pasando un String (el texto, la etiqueta). También se puede poner imágenes, un fondo, un texto, pero no sonido. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">En la quinta línea tuvimos que buscar el método add() en el API. Miramos en la clase JPanel,</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#99cc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Class JPanel</span></span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><a title="class in java.lang" href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html"><span><span style="font-size:small;font-family:Times New Roman;">java.lang.Object</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span><span style="font-size:small;font-family:Times New Roman;">  </span></span></span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html"><span><span style="font-size:small;font-family:Times New Roman;">java.awt.Component</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span><span style="font-size:small;font-family:Times New Roman;">      </span></span></span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Container.html"><span><span style="font-size:small;font-family:Times New Roman;">java.awt.Container</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span><span style="font-size:small;font-family:Times New Roman;">          </span></span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JComponent.html"><span><span style="font-size:small;font-family:Times New Roman;">javax.swing.JComponent</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span><span style="font-size:small;font-family:Times New Roman;">              </span></span></span><strong><span style="font-size:small;font-family:Times New Roman;">javax.swing.JPanel</span></strong></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">De aquí averiguamos que add() es un método que hereda de la clase java.awt.Container. Pinchando en él encontramos:</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#99cc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span><span style="font-size:small;"><span style="font-family:Times New Roman;">add</span></span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">public </span></span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html"><span><span style="font-size:small;font-family:Times New Roman;">Component</span></span></a><span style="font-size:small;"><span style="font-family:Times New Roman;"><span> </span><strong><span>add</span></strong><span>(</span></span></span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html"><span><span style="font-size:small;font-family:Times New Roman;">Component</span></span></a><span><span style="font-size:small;"><span style="font-family:Times New Roman;"> comp)</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">Appends the specified component to the end of this container. This is a convenience method for </span></span><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Container.html#addImpl(java.awt.Component, java.lang.Object, int)"><span><span style="font-size:small;font-family:Times New Roman;">addImpl(java.awt.Component, java.lang.Object, int)</span></span></a><span><span style="font-size:small;"><span style="font-family:Times New Roman;">. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Note: If a component has been added to a container that has been displayed, validate must be called on that container to display the new component. If multiple components are being added, you can improve efficiency by calling validate only once, after all the components have been added. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Parameters:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">comp &#8211; the component to be added </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Returns:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">the component argument </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>See Also:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Container.html#addImpl(java.awt.Component, java.lang.Object, int)"><span><span style="font-size:small;font-family:Times New Roman;">addImpl(java.awt.Component, java.lang.Object, int)</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Container.html#validate()"><span><span style="font-size:small;font-family:Times New Roman;">validate()</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JComponent.html#revalidate()"><span><span style="font-size:small;font-family:Times New Roman;">JComponent.revalidate()</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">el cual devuelve un Componente y se le pasa por parámetro un componente. Como JLabel hereda de Componente:</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span style="font-size:small;"><span style="font-family:Times New Roman;">javax.swing<br />
Class JLabel</span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><a title="class in java.lang" href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html"><span style="font-size:small;font-family:Times New Roman;">java.lang.Object</span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;">  </span></span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html"><span><span style="font-size:small;font-family:Times New Roman;">java.awt.Component</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span><span style="font-size:small;font-family:Times New Roman;">      </span></span></span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Container.html"><span><span style="font-size:small;font-family:Times New Roman;">java.awt.Container</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span><span style="font-size:small;font-family:Times New Roman;">          </span></span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JComponent.html"><span><span style="font-size:small;font-family:Times New Roman;">javax.swing.JComponent</span></span></a></p>
<p class="MsoNormal" style="margin:0;"><span><span><span style="font-size:small;font-family:Times New Roman;">              </span></span></span><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>javax.swing.JLabel</span></strong></span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Se lo pasamos por parámetro.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Nos pareció un poco lioso. Como nos tengamos que aprender de que hereda cada clase y cada método que tiene cada uno para saber cuál podemos utilizar, todo va a ser un cacao maravillao.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">En la sexta línea miramos en el API la clase JFrame buscando el método setSize(). Encontramos éste, y también el setVisible(), que aparece en la línea número siete, que heredaban de la clase java.awt.Component:</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<table class="MsoTableGrid" style="background:#99cc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span><span style="font-size:small;"><span style="font-family:Times New Roman;">setSize</span></span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">public void <strong>setSize</strong>(int width, int height)</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Resizes this component so that it has width width and height height. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Parameters:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">width &#8211; the new width of this component in pixels </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">height &#8211; the new height of this component in pixels </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Since:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">JDK1.1 </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>See Also:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#getSize()"><span><span style="font-size:small;font-family:Times New Roman;">getSize()</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#setBounds(int, int, int, int)"><span><span style="font-size:small;font-family:Times New Roman;">setBounds(int, int, int, int)</span></span></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span><span style="font-size:small;"><span style="font-family:Times New Roman;">setVisible</span></span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">public void <strong>setVisible</strong>(boolean b)</span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Shows or hides this component depending on the value of parameter b. </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Parameters:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">b &#8211; if true, shows this component; otherwise, hides this component </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Since:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">JDK1.1 </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>See Also:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#isVisible()"><span><span style="font-size:small;font-family:Times New Roman;">isVisible()</span></span></a></p>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">con setSize() ajustamos el tamaño del marco. Cuando la ventana se represente en pantalla será del tamaño que le hayamos dicho.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Con setVisible() se muestra por pantalla, si lo pones a true.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Al saber esto fue sencillo adivinar que había cambiar para que la ventana aumentase su tamaño cuatro veces. Tan solo hay que modificar los parámetros del método setSize(), multiplicándolos por cuatro.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Para crear una nueva clase en la que el fondo de la etiqueta tenga color azul, fuimos al API en la clase JLabel. Tras mucho buscar no lo logramos encontrar, el API es inmenso, además nosotros íbamos buscando algún método que realizase tal función, pero ahora que lo pensamos lo que más sentido tiene es un set. Hasta que no se dijo en clase no supimos que era necesario el setBackground(Color.BLUE);</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<table class="MsoTableGrid" style="background:#99cc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h3 style="margin:auto 0;"><span><span style="font-size:medium;"><span style="font-family:Times New Roman;">setBackground</span></span></span></h3>
<pre><span><span style="font-size:x-small;">public void <strong>setBackground</strong>(</span></span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Color.html"><span><span style="font-size:x-small;">Color</span></span></a><span><span style="font-size:x-small;"> bg)</span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">Sets the background color of this component. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Overrides:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><code><span style="font-size:10pt;"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#setBackground(java.awt.Color)"><span>setBackground</span></a></span></code><span><span style="font-size:small;font-family:Times New Roman;"> in class </span></span><code><span style="font-size:10pt;"><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html"><span>Component</span></a></span></code></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Parameters:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><code><span style="font-size:10pt;">bg</span></code><span><span style="font-size:small;font-family:Times New Roman;"> &#8211; the desired background </span></span><code><span style="font-size:10pt;">Color</span></code><span><span style="font-size:small;"><span style="font-family:Times New Roman;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>See Also:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#getBackground()"><code><span style="font-size:10pt;">Component.getBackground()</span></code></a></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<h2 style="margin:12pt 0 3pt;"><span style="font-weight:normal;font-size:12pt;font-style:normal;">Procedente de la clase JComponent, la cual es superclase de JLabel: </span></h2>
<h2 style="margin:12pt 0 3pt;"><em><span style="font-family:Arial;"><span><span style="font-size:large;"> </span></span><span style="font-size:10pt;">javax.swing</span></span></em><span><em><span style="font-size:large;"><span style="font-family:Arial;"><br />
Class JComponent</span></span></em></span></h2>
<pre><a title="class in java.lang" href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html"><span><span style="font-size:x-small;">java.lang.Object</span></span></a>
<span><span><span style="font-size:x-small;">  </span></span></span>
<span style="font-size:x-small;">
  </span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html"><span><span style="font-size:x-small;">java.awt.Component</span></span></a>
<span><span><span style="font-size:x-small;">      </span></span></span>
<span style="font-size:x-small;">
  </span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Container.html"><span><span style="font-size:x-small;">java.awt.Container</span></span></a>
<span><span><span style="font-size:x-small;">          </span></span></span>
<span style="font-size:x-small;">
  </span><span style="font-size:x-small;"><strong><span>javax.swing.JComponent</span></strong></span></pre>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>All Implemented Interfaces:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><a title="interface in java.awt.image" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/image/ImageObserver.html"><span><span style="font-size:small;font-family:Times New Roman;">ImageObserver</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="interface in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/MenuContainer.html"><span><span style="font-size:small;font-family:Times New Roman;">MenuContainer</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="interface in java.io" href="http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html"><span><span style="font-size:small;font-family:Times New Roman;">Serializable</span></span></a><span><span style="font-size:small;"><span style="font-family:Times New Roman;"> </span></span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Direct Known Subclasses:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/AbstractButton.html"><span><span style="font-size:small;font-family:Times New Roman;">AbstractButton</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="class in javax.swing.plaf.basic" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/plaf/basic/BasicInternalFrameTitlePane.html"><span><span style="font-size:small;font-family:Times New Roman;">BasicInternalFrameTitlePane</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/Box.html"><span><span style="font-size:small;font-family:Times New Roman;">Box</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/Box.Filler.html"><span><span style="font-size:small;font-family:Times New Roman;">Box.Filler</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JColorChooser.html"><span><span style="font-size:small;font-family:Times New Roman;">JColorChooser</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JComboBox.html"><span><span style="font-size:small;font-family:Times New Roman;">JComboBox</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JFileChooser.html"><span><span style="font-size:small;font-family:Times New Roman;">JFileChooser</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JInternalFrame.html"><span><span style="font-size:small;font-family:Times New Roman;">JInternalFrame</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JInternalFrame.JDesktopIcon.html"><span><span style="font-size:small;font-family:Times New Roman;">JInternalFrame.JDesktopIcon</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JLabel.html"><span><span style="font-size:small;font-family:Times New Roman;">JLabel</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JLayeredPane.html"><span><span style="font-size:small;font-family:Times New Roman;">JLayeredPane</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JList.html"><span><span style="font-size:small;font-family:Times New Roman;">JList</span></span></a><span><span style="font-size:small;font-family:Times New Roman;">, </span></span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JMenuBar.html"><span style="font-size:small;font-family:Times New Roman;">JMenuBar</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JOptionPane.html"><span style="font-size:small;font-family:Times New Roman;">JOptionPane</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JPanel.html"><span style="font-size:small;font-family:Times New Roman;">JPanel</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JPopupMenu.html"><span style="font-size:small;font-family:Times New Roman;">JPopupMenu</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JProgressBar.html"><span style="font-size:small;font-family:Times New Roman;">JProgressBar</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JRootPane.html"><span style="font-size:small;font-family:Times New Roman;">JRootPane</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JScrollBar.html"><span style="font-size:small;font-family:Times New Roman;">JScrollBar</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JScrollPane.html"><span style="font-size:small;font-family:Times New Roman;">JScrollPane</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JSeparator.html"><span style="font-size:small;font-family:Times New Roman;">JSeparator</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JSlider.html"><span style="font-size:small;font-family:Times New Roman;">JSlider</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JSpinner.html"><span style="font-size:small;font-family:Times New Roman;">JSpinner</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JSplitPane.html"><span style="font-size:small;font-family:Times New Roman;">JSplitPane</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTabbedPane.html"><span style="font-size:small;font-family:Times New Roman;">JTabbedPane</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTable.html"><span style="font-size:small;font-family:Times New Roman;">JTable</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing.table" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/table/JTableHeader.html"><span style="font-size:small;font-family:Times New Roman;">JTableHeader</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing.text" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/JTextComponent.html"><span style="font-size:small;font-family:Times New Roman;">JTextComponent</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JToolBar.html"><span style="font-size:small;font-family:Times New Roman;">JToolBar</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JToolTip.html"><span style="font-size:small;font-family:Times New Roman;">JToolTip</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTree.html"><span style="font-size:small;font-family:Times New Roman;">JTree</span></a><span style="font-size:small;font-family:Times New Roman;">, </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JViewport.html"><span style="font-size:small;font-family:Times New Roman;">JViewport</span></a><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<h3 style="margin:auto 0;"><span style="font-size:medium;font-family:Times New Roman;"> </span></h3>
</td>
</tr>
</tbody>
</table>
<h3 style="margin:auto 0;"><span style="font-size:medium;font-family:Times New Roman;"> </span></h3>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;">Al colocarla nos saltaba un error extraño, y el profesor nos ánimo a que observásemos bien lo que teníamos frente a nosotros, el API abierto por esa última clase. Nosotros entonces dijimos: “ah!, tendremos que importar JComponent”. POS’ NO (AMPARO, MANUELA, PO’ NO…..¿tas’ fumao’ un porro? </span><span style="font-family:Wingdings;"><span>J</span></span><span style="font-family:Times New Roman;">jaja), porque JLabel hereda de JComponent. Lo que era necesario importar era la clase Color, para poder llamar a su atributo BLUE. El objeto de la clase Color ya está hecho. Color tiene una colección de tipos static, cada uno es un color. Entonces, nosotros escribimos: import java.awt.*; La verdad es que no estaba mal, así importábamos la clase Color pero también todas las demás que se encuentran en el paquete awt, de esta manera gastamos memoria. Lo mejor es colocar: import java.awt.Color; tal y como nos aconsejó el profesor, así la próxima vez que nos ocurra el mismo tipo de error, sabremos de donde proviene. De esta manera evitamos lo que se dice más adelante en la práctica, pensar que todo se hace como por arte de magia, ya que si para cada momento importamos tan solo lo estrictamente necesario aprenderemos cómo y por qué funciona cada cosa. </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Después tuvimos otro problema, sin saber el motivo no nos aparecía en la ventana el esperado color azul de la etiqueta. Esto era causado por la falta del método setOpaque() en la clase HelloWorldGUIColor. </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<table class="MsoTableGrid" style="background:#99cc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h3 style="margin:auto 0;"><span><span style="font-size:medium;"><span style="font-family:Times New Roman;">setOpaque</span></span></span></h3>
<pre><span><span style="font-size:x-small;">public void <strong>setOpaque</strong>(boolean isOpaque)</span></span></pre>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span><span style="font-size:small;"><span style="font-family:Times New Roman;">If true the component paints every pixel within its bounds. Otherwise, the component may not paint some or all of its pixels, allowing the underlying pixels to show through. </span></span></span></p>
<p style="margin-left:36pt;"><span><span style="font-size:small;font-family:Times New Roman;">The default value of this property is false for </span></span><code><span style="font-size:10pt;">JComponent</span></code><span><span style="font-size:small;font-family:Times New Roman;">. However, the default value for this property on most standard </span></span><code><span style="font-size:10pt;">JComponent</span></code><span><span style="font-size:small;font-family:Times New Roman;"> subclasses (such as </span></span><code><span style="font-size:10pt;">JButton</span></code><span><span style="font-size:small;font-family:Times New Roman;"> and </span></span><code><span style="font-size:10pt;">JTree</span></code><span><span style="font-size:small;"><span style="font-family:Times New Roman;">) is look-and-feel dependent. </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong><span>Parameters:</span></strong><span> </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><code><span style="font-size:10pt;">isOpaque</span></code><span><span style="font-size:small;"><span style="font-family:Times New Roman;"> &#8211; true if this component should be opaque </span></span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><strong>See Also:</strong> </span></span></p>
<p class="MsoNormal" style="margin:0 0 0 36pt;"><a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JComponent.html#isOpaque()"><code><span style="font-size:10pt;">isOpaque()</span></code></a></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Tan solo con poner el parámetro a true, logramos que se pinte el componente y se vea por pantalla. Si no se pone el setOpaque(), no aparece el color. Deducimos entonces que los componentes pueden ser opacos o no, y las etiquetas pueden ser transparentes u opacas. Utilizar el método setBackground() sólo tiene sentido si el componente es opaco. Este método hereda de la clase JComponent:</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<table class="MsoTableGrid" style="background:#99cc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<h2 style="margin:12pt 0 3pt;"><span style="font-size:10pt;"><em><span style="font-family:Arial;">javax.swing</span></em></span><span><em><span style="font-size:large;"><span style="font-family:Arial;"><br />
Class JLabel</span></span></em></span></h2>
<pre><a title="class in java.lang" href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html"><span><span style="font-size:x-small;">java.lang.Object</span></span></a>
<span><span><span style="font-size:x-small;">  </span></span></span>
<span style="font-size:x-small;">
  </span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html"><span><span style="font-size:x-small;">java.awt.Component</span></span></a>
<span><span><span style="font-size:x-small;">      </span></span></span>
<span style="font-size:x-small;">
  </span><a title="class in java.awt" href="http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Container.html"><span><span style="font-size:x-small;">java.awt.Container</span></span></a>
<span><span><span style="font-size:x-small;">          </span></span></span>
<span style="font-size:x-small;">
  </span><a title="class in javax.swing" href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JComponent.html"><span><span style="font-size:x-small;">javax.swing.JComponent</span></span></a>
<span><span><span style="font-size:x-small;">              </span></span></span>
<span style="font-size:x-small;">
  </span><span style="font-size:x-small;"><strong><span>javax.swing.JLabel</span></strong></span></pre>
<p class="MsoNormal" style="margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">A continuación se nos presentaban con los manejadores de ventana, y entendimos que éste es lo que pinta la ventana. El programa no puede controlar todo lo que ocurre en la pantalla, hay distintas ventanas abiertas en la pantalla. Esto se soluciona con el concepto de ventanas. A cada programa que quiere utilizar una interfaz gráfica, se le da un rectángulo, una ventana, la cual crea el manejador de ventana. Un programa se puede comunicar con el usuario con color, texto, imágenes,… El usuario se comunica con el programa escribiendo (JText), JButtom,.. El programa se tiene que comunicar con el manejador de ventanas en algún momento para dibujarle la ventana. La barra superior de una ventana (la que contiene los botones minimizar, maximizar y cerrar) es del manejador de ventana (si das a la aspa, el manejador de ventana dice al programa que se tiene que cerrar, el programa tiene que ejecutar) y el panel es “responsabilidad” del programa. No es necesario que el usuario se comunique con el manejador de ventana, porque para eso esta el programa. En resumen, el manejador de ventana gestiona las ventanas y el manejador de ventana se comunica con el usuario. Un ejemplo es cuando pulsamos el alt+tabulador para elegir entre distintas ventanas de la barra de estado.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Basándonos en la clase que nos dan al comienzo de la práctica, hay que superar una serie de retos.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">El primer reto con el que nos topamos (y no somos topos <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) dentro de este campo, fue realizar una clase en la que se ignorase el mensaje de cierre del manejador de ventana. En un principio pensamos en utilizar el método descrito en la práctica setDefaultCloseOperation(), pero después caímos en la cuenta de la tontería que íbamos a hacer. Para ignorar el mensaje de cierre, simplemente evitamos que llegue ese mensaje quitando la sentencia que lo provoca, es decir, quitando frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); La diferencia es que ahora, puedes cerrar la ventana pinchando en el aspa, pero el programa sigue corriendo, sigue ejecutado. Para pararlo hay que pulsar ctrl+ C.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Le sigue el reto de hacer que no se utilice ninguna decoración del manejador de ventanas. Dedicamos un poco de nuestro tiempo a leer los métodos explicados en la práctica. Claramente lo vimos, su propio nombre lo describía, setUndecorated(). Al llamarlo se queda el panel con su fondo grisáceo y su etiqueta HelloWorld! sobre él, pero desaparece ese borde azul típico de las ventanas de Windows y su barrita superior con sus tres monos botoncitos, obviamente, tampoco aparece el título que se le daba a esa barra, HelloWorldGUI window title.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Por último, había que hacer una clase que utilizase el Look and Feel por defecto en Java en vez del que estés usando con el manejador de ventanas. No estábamos muy seguros de si sería el método setDefaultLookAndFeelDecorated(boolean b) [jeje] ya que no nos lo insinúan para nada en el enunciado jeje. Desde luego nos quedó claro de forma teórica solamente la función que desempeñaba tal método, porque de escribirlo a no, no encontramos ninguna diferencia al respecto.</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">Y HASTA AQUÍ NUESTRA SESIÓN DE PRÁCTICAS. ÁNIMO QUE YA FALTAN POCAS!! Y RECUERDA: NO OLVIDES VISITARNOS. TE ESPERAMOS!! <span> </span> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;">PD. Oh my Gosh, ahora también nos entra complejo de Anne Igartiburu, o como leches se escriba!!</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span><span style="font-size:small;font-family:Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="text-indent:18pt;text-align:center;margin:0;" align="center"><strong><span style="font-size:small;font-family:Times New Roman;"> </span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;text-align:center;margin:0;" align="center"><strong><span style="font-size:small;"><span style="font-family:Times New Roman;">Ejercicio 2</span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<table class="MsoTableGrid" style="background:#ffcc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;">import javax.swing.JFrame;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JPanel;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JLabel;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>class HelloWorldGUIDeaf </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>public static void main(String args[]) </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JFrame frame = new JFrame(&#8220;HelloWorldGUI window title&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JPanel contentPane = (JPanel) frame.getContentPane();</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JLabel label = new JLabel(&#8220;Hello World!&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>contentPane.add(label);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setSize(100,50);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setVisible(true);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>}</span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;text-align:center;margin:0;" align="center"><span><span style="font-size:small;"><span style="font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/05/helloworldgui.jpg"><img class="alignnone size-full wp-image-83 alignleft" style="float:left;" src="http://albalba.files.wordpress.com/2008/05/helloworldgui.jpg?w=124&#038;h=49" alt="" width="124" height="49" /></a></span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;"><span style="font-family:Times New Roman;"><span>                        </span><span> </span></span></span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"> </p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"> </p>
<table class="MsoTableGrid" style="background:#ffcc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;">import javax.swing.JFrame;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JPanel;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JLabel;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>class HelloWorldGUIUndecorated</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>public static void main(String args[]) </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JFrame frame = new JFrame(&#8220;HelloWorldGUI window title&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setUndecorated(true);<span>     </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JPanel contentPane = (JPanel) frame.getContentPane();</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JLabel label = new JLabel(&#8220;Hello World!&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>contentPane.add(label);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setSize(100,50);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setVisible(true);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>}</span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;text-align:left;margin:0;"> </p>
<p class="MsoNormal" style="text-indent:18pt;text-align:left;margin:0;"><a href="http://albalba.files.wordpress.com/2008/05/helloworldundecorated.jpg"><img class="alignnone size-full wp-image-84" src="http://albalba.files.wordpress.com/2008/05/helloworldundecorated.jpg?w=101&#038;h=50" alt="" width="101" height="50" /></a></p>
<p class="MsoNormal" style="text-indent:18pt;text-align:center;margin:0;" align="center"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<table class="MsoTableGrid" style="background:#ffcc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;">import javax.swing.JFrame;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JPanel;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JLabel;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>class HelloWorldGUIDecorated</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>public static void main(String args[]) </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JFrame.setDefaultLookAndFeelDecorated(true );</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JFrame frame = new JFrame(&#8220;HelloWorldGUI window title&#8221;);<span>     </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JPanel contentPane = (JPanel) frame.getContentPane();</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JLabel label = new JLabel(&#8220;Hello World!&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>contentPane.add(label);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setSize(100,50);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setVisible(true);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>    </span><span>  </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>}</span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;text-align:left;margin:0;"> </p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/05/helloworlddecorated.jpg"><img class="alignnone size-full wp-image-85" src="http://albalba.files.wordpress.com/2008/05/helloworlddecorated.jpg?w=101&#038;h=50" alt="" width="101" height="50" /></a> </span></p>
<p class="MsoNormal" style="text-indent:18pt;text-align:left;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:small;font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;text-align:center;margin:0;" align="center"><strong><span style="font-size:small;"><span style="font-family:Times New Roman;">Ejercicio 3</span></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;text-align:center;margin:0;" align="center"><strong><span style="font-size:small;font-family:Times New Roman;"> </span></strong></p>
<table class="MsoTableGrid" style="background:#ffcc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;">import javax.swing.JFrame;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JPanel;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JLabel;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import java.awt.Color;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>public class CompassSimple</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>public CompassSimple()</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JFrame frame=new JFrame(&#8220;CompassSimple&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JPanel contentPane=(JPanel) frame.getContentPane();</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span></span><span style="font-size:9pt;">JLabel label=new JLabel(&#8220;Hola mundo <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> &#8220;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span></span><span style="font-size:9pt;">label.setForeground(Color.WHITE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>label.setBackground(Color.BLACK);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>label.setOpaque(true);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>contentPane.add(label);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setExtendedState(JFrame.MAXIMIZED_BOTH);//maximiza la ventana </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setVisible(true);<span>  </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>public static void main (String[] args)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>CompassSimple nuevo=new CompassSimple();</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>}</span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span style="font-size:small;font-family:Times New Roman;"> </span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;text-align:center;margin:0;" align="center"><strong></strong></p>
<p class="MsoNormal" style="text-indent:18pt;text-align:left;margin:0;"><strong><span style="font-size:small;font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/05/compasssimple.jpg"></a> <a href="http://albalba.files.wordpress.com/2008/05/helloworldguibig.jpg"><img class="alignnone size-medium wp-image-91" src="http://albalba.files.wordpress.com/2008/05/helloworldguibig.jpg?w=300&#038;h=218" alt="" width="300" height="218" /></a><a href="http://albalba.files.wordpress.com/2008/05/compasssimple_.jpg"></a></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;text-align:center;margin:0;" align="center"><strong><span style="font-size:small;font-family:Times New Roman;"> </span></strong></p>
<table class="MsoTableGrid" style="background:#ffcc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>  </span>import javax.swing.JFrame;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JLabel;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JPanel;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import java.awt.Color;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import java.awt.BorderLayout;//importante importar si no no podemos colocar (eso del WEST EAST SOUTH NORTH)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>public class CompassSimple_</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>public CompassSimple_()</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JFrame frame=new JFrame(&#8220;CompassSimple&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JPanel contentPane=(JPanel) frame.getContentPane();</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JLabel north=new JLabel(&#8220;North&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JLabel south=new JLabel(&#8220;South&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JLabel west=new JLabel(&#8220;West&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JLabel east=new JLabel(&#8220;East&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>north.setForeground(Color.WHITE);//color de letra </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>north.setBackground(Color.BLACK);//color de fondo</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span></span><span style="font-size:9pt;">north.setOpaque(true);//para poder ver los colores</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>contentPane.add(north,BorderLayout.NORTH);//añadimos al panel la etiqueta y la horientacion</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span></span><span style="font-size:9pt;">south.setForeground(Color.BLACK);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>south.setBackground(Color.WHITE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>south.setOpaque(true);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>contentPane.add(south, BorderLayout.SOUTH);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>west.setForeground(Color.BLUE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>west.setBackground(Color.RED);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>west.setOpaque(true);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>contentPane.add(west, BorderLayout.WEST);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>east.setForeground(Color.RED);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>east.setBackground(Color.BLUE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>east.setOpaque(true);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>  </span><span>       </span>contentPane.add(east,BorderLayout.EAST); </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span></span><span style="font-size:9pt;">frame.setSize(200,100);//esto es para cuando minimisamos no se achurrusque del todo</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span></span><span style="font-size:9pt;">frame.setExtendedState(JFrame.MAXIMIZED_BOTH);//maximiza la ventana </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>        </span><span> </span>frame.setVisible(true);<span>  </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>public static void main(String[] args)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>CompassSimple_ nuevo=new CompassSimple_();</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>}</span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span style="font-size:small;font-family:Times New Roman;"> </span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span style="font-size:small;font-family:Times New Roman;"><a href="http://albalba.files.wordpress.com/2008/05/compasssimple_.jpg"></a> <a href="http://albalba.files.wordpress.com/2008/05/compasssimple_.jpg"><img class="alignnone size-medium wp-image-87" src="http://albalba.files.wordpress.com/2008/05/compasssimple_.jpg?w=300&#038;h=218" alt="" width="300" height="218" /></a></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><a href="http://albalba.files.wordpress.com/2008/05/compasssimple.jpg"></a></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span style="font-size:small;font-family:Times New Roman;"> </span></strong></p>
<table class="MsoTableGrid" style="background:#ffcc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;">import javax.swing.JFrame;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JPanel;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JLabel;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import java.awt.Color;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>import java.awt.BorderLayout;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>public class CompassBetter </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>public CompassBetter ()</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JFrame frame=new JFrame(&#8220;CompassSimple&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span></span><span style="font-size:9pt;">JPanel contentPane=(JPanel) frame.getContentPane();//si queremos luego manipular en el panel tenemos q hacer esto si no hace cosas raras</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>contentPane.setBackground(Color.BLACK);//poner el fondo del panel en negro no nos lo piden lo ponemos nosotros</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span></span><span style="font-size:9pt;">JLabel north=new JLabel(&#8220;North&#8221;,JLabel.CENTER);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JLabel south=new JLabel(&#8220;South&#8221;,JLabel.CENTER);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JLabel west=new JLabel(&#8220;West&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>JLabel east=new JLabel(&#8220;East&#8221;);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>north.setForeground(Color.WHITE);//color de letra </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>north.setBackground(Color.BLACK);//color de fondo</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span></span><span style="font-size:9pt;">north.setOpaque(true);//para poder ver los colores</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>contentPane.add(north,BorderLayout.NORTH);//añadimos al panel la etiqueta y la horientacion</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span></span><span style="font-size:9pt;">south.setForeground(Color.WHITE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>south.setBackground(Color.BLACK);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>south.setOpaque(true);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>contentPane.add(south, BorderLayout.SOUTH);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>west.setForeground(Color.WHITE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>west.setBackground(Color.BLACK);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>west.setOpaque(true);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>contentPane.add(west, BorderLayout.WEST);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>east.setForeground(Color.WHITE);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>east.setBackground(Color.BLACK);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>east.setOpaque(true);</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>contentPane.add(east,BorderLayout.EAST); </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span><span style="font-size:9pt;">/*esto no nos lo piden nosotros lo ponemos*/</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setSize(250,250);//esto es para cuando minimisamos no se achurrusque del todo</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span></span><span style="font-size:9pt;">frame.setExtendedState(JFrame.MAXIMIZED_BOTH);//maximiza la ventana </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>frame.setVisible(true);<span>  </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>public static void main(String[] args)</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>{</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>         </span>CompassBetter<span>  </span>nuevo=new CompassBetter ();</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>      </span>}</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:9pt;"><span>   </span>}</span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span style="font-size:small;font-family:Times New Roman;"> </span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span style="font-size:small;font-family:Times New Roman;"> <a href="http://albalba.files.wordpress.com/2008/05/compasssimple.jpg"><img class="alignnone size-full wp-image-86" src="http://albalba.files.wordpress.com/2008/05/compasssimple.jpg?w=250&#038;h=250" alt="" width="250" height="250" /></a></span></strong></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><strong><span style="font-size:small;font-family:Times New Roman;"> </span></strong></p>
<table class="MsoTableGrid" style="background:#ffcc00;border-collapse:collapse;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width:432.2pt;background-color:transparent;border:windowtext 1pt solid;padding:0 5.4pt;" width="576" valign="top">
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;">import javax.swing.JFrame;</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.JLabel;</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;"><span>  </span><span> </span>import javax.swing.JPanel;</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.ImageIcon;</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;"><span>   </span>import javax.swing.Icon;</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;"><span>   </span>import java.awt.Color;</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;"><span>   </span>import java.awt.BorderLayout;//importante importar si no no podemos colocar (eso del WEST EAST SOUTH NORTH)</span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;"> </span></p>
<p class="MsoNormal" style="text-indent:18pt;margin:0;"><span style="font-size:9pt;"><span>   </span>public cl