<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
>
	<channel>
		<title>Dudas de Programacion &#187; Tag: gui - Recent Posts</title>
		<link>http://www.dudasprogramacion.com/tags/gui</link>
		<description>Dudas sobre lenguajes y apis de programación</description>
		<language>en-US</language>
		<pubDate>Sun, 05 Feb 2012 07:16:50 +0000</pubDate>
		<generator>bbpress 1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.dudasprogramacion.com/search.php</link>
		</textInput>
		<atom:link href="http://www.dudasprogramacion.com/rss/tags/gui" rel="self" type="application/rss+xml" />

		<item>
			<title>fiurer87 on "Como programar un chat en Java con interfaz grafica"</title>
			<link>http://www.dudasprogramacion.com/topic/como-programar-un-chat-en-java-con-interfaz-grafica#post-444</link>
			<pubDate>Sun, 23 May 2010 22:52:38 +0000</pubDate>
			<dc:creator>fiurer87</dc:creator>
			<guid isPermaLink="false">444@http://www.dudasprogramacion.com/</guid>
			<description><p>Gracias Admin, pero soy fiurer87  no  figure87.
</p></description>
		</item>
		<item>
			<title>admin on "Como programar un chat en Java con interfaz grafica"</title>
			<link>http://www.dudasprogramacion.com/topic/como-programar-un-chat-en-java-con-interfaz-grafica#post-440</link>
			<pubDate>Sun, 23 May 2010 19:56:29 +0000</pubDate>
			<dc:creator>admin</dc:creator>
			<guid isPermaLink="false">440@http://www.dudasprogramacion.com/</guid>
			<description><p>@Torres, @figure87,</p>
<p>Agradeceros a los dos vuestra amplia colaboración en el foro.<br />
Muchas gracias.
</p></description>
		</item>
		<item>
			<title>fiurer87 on "Como programar un chat en Java con interfaz grafica"</title>
			<link>http://www.dudasprogramacion.com/topic/como-programar-un-chat-en-java-con-interfaz-grafica#post-433</link>
			<pubDate>Fri, 21 May 2010 12:34:26 +0000</pubDate>
			<dc:creator>fiurer87</dc:creator>
			<guid isPermaLink="false">433@http://www.dudasprogramacion.com/</guid>
			<description><p>Gracias por la aclaracion.</p>
<p>Puse el ejemplo por que el hilo de la conversacion sigue activo, y como tengo el codigo para hacer lo que pedia, quiza pueda ayudar a otros ahora o en un futuro (si java sigue vigente para entonces). Asi que hilo abierto aunque pasadito siempre es una fuente de informacion para otros internautas.</p>
<p>Atte: Roberto
</p></description>
		</item>
		<item>
			<title>Torres on "Como programar un chat en Java con interfaz grafica"</title>
			<link>http://www.dudasprogramacion.com/topic/como-programar-un-chat-en-java-con-interfaz-grafica#post-431</link>
			<pubDate>Fri, 21 May 2010 07:43:50 +0000</pubDate>
			<dc:creator>Torres</dc:creator>
			<guid isPermaLink="false">431@http://www.dudasprogramacion.com/</guid>
			<description><p>fiurer87 veo que has entrado con fuerza en el foro, pero fíjate que el mensaje original tiene 6 meses de antigüedad, si es 6 meses no consiguio hacer un chat en Java, mal vamos jeje.</p>
<p>Un saludo
</p></description>
		</item>
		<item>
			<title>fiurer87 on "¿Obtener las posición del cursor en un JTextField en Java?"</title>
			<link>http://www.dudasprogramacion.com/topic/%c2%bfobtener-las-posicion-del-cursor-en-un-jtextfield-en-java#post-401</link>
			<pubDate>Sun, 16 May 2010 15:53:14 +0000</pubDate>
			<dc:creator>fiurer87</dc:creator>
			<guid isPermaLink="false">401@http://www.dudasprogramacion.com/</guid>
			<description><p>Seria ideal que los administradores del foro habiliten de una vez el [CODE], o algun medio para subir el codigo. :)
</p></description>
		</item>
		<item>
			<title>fiurer87 on "¿Obtener las posición del cursor en un JTextField en Java?"</title>
			<link>http://www.dudasprogramacion.com/topic/%c2%bfobtener-las-posicion-del-cursor-en-un-jtextfield-en-java#post-400</link>
			<pubDate>Sun, 16 May 2010 15:51:16 +0000</pubDate>
			<dc:creator>fiurer87</dc:creator>
			<guid isPermaLink="false">400@http://www.dudasprogramacion.com/</guid>
			<description><p>Hola,</p>
<p>el metodo getCaretPosition() devuelve la posicion donde se encuentra el (&#124;) en el texto, esta posicion es un entero que va desde 0 hasta el ultimo caracter de lo que esta escrito dentro del JTEXTAREA. ademas existe el metodo insert(String s, int pos), que escribe el texto s en la posicion pos, la posicion la obtendremos con el primer metodo mencionado. Bueno te paso de una vez el codigo, para que lo pruebes, espero sea de ayuda :). Saludos</p>
<p>=========================================================<br />
/* Inserta la palabra NUEVO, en la posicion del &#124; dentro de JTextArea<br />
   @author Luis Roberto Perez Rios*/</p>
<p>import javax.swing.JFrame;<br />
import javax.swing.JTextArea;<br />
import javax.swing.JButton;<br />
import java.awt.event.ActionEvent;<br />
import java.awt.event.ActionListener;<br />
import java.awt.BorderLayout;</p>
<p>public class Marco extends JFrame{<br />
    private JTextArea area;<br />
    private JButton boton;</p>
<p>    public Marco(){<br />
        super(&#34;Insertar&#34;);<br />
        setLayout(new BorderLayout());<br />
        setSize(200,200);<br />
        area = new JTextArea();<br />
        boton = new JButton(&#34;Insertar NUEVO&#34;);<br />
        boton.addActionListener(new ActionListener(){<br />
            public void actionPerformed(ActionEvent ae){<br />
                area.insert(&#34;NUEVO&#34;, area.getCaretPosition());<br />
            }<br />
        });</p>
<p>        add(area, BorderLayout.CENTER);<br />
        add(boton, BorderLayout.SOUTH);<br />
    }</p>
<p>    public static void main(String[] arg){<br />
        Marco marco = new Marco();<br />
        marco.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br />
        marco.setVisible(true);<br />
    }<br />
}
</p></description>
		</item>
		<item>
			<title>fiurer87 on "Como programar un chat en Java con interfaz grafica"</title>
			<link>http://www.dudasprogramacion.com/topic/como-programar-un-chat-en-java-con-interfaz-grafica#post-399</link>
			<pubDate>Sat, 15 May 2010 19:12:27 +0000</pubDate>
			<dc:creator>fiurer87</dc:creator>
			<guid isPermaLink="false">399@http://www.dudasprogramacion.com/</guid>
			<description><p>Para probar esto, es importante que primero ejecutes el Servidor, esto se debe a que se esta usando TCP, saludos :)</p>
<p>Espero sea de ayuda
</p></description>
		</item>
		<item>
			<title>fiurer87 on "Como programar un chat en Java con interfaz grafica"</title>
			<link>http://www.dudasprogramacion.com/topic/como-programar-un-chat-en-java-con-interfaz-grafica#post-397</link>
			<pubDate>Sat, 15 May 2010 19:06:03 +0000</pubDate>
			<dc:creator>fiurer87</dc:creator>
			<guid isPermaLink="false">397@http://www.dudasprogramacion.com/</guid>
			<description><p>Este el codigo para ejecutar Cliente, recuerda que se hace uso de tu servidor interno LOCALHOST 127.0.0.1<br />
===========================================<br />
import javax.swing.JFrame;<br />
public class ClientTest {<br />
    public static void main( String args[] ) {<br />
        Cliente cliente;<br />
        cliente = new Cliente( &#34;127.0.0.1&#34; );<br />
        cliente.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
        cliente.correrCliente();<br />
    }<br />
}
</p></description>
		</item>
		<item>
			<title>fiurer87 on "Como programar un chat en Java con interfaz grafica"</title>
			<link>http://www.dudasprogramacion.com/topic/como-programar-un-chat-en-java-con-interfaz-grafica#post-396</link>
			<pubDate>Sat, 15 May 2010 19:04:55 +0000</pubDate>
			<dc:creator>fiurer87</dc:creator>
			<guid isPermaLink="false">396@http://www.dudasprogramacion.com/</guid>
			<description><p>Este el codigo para un Cliente para el chat<br />
===========================================<br />
import java.io.EOFException;<br />
import java.io.IOException;<br />
import java.io.ObjectInputStream;<br />
import java.io.ObjectOutputStream;<br />
import java.net.InetAddress;<br />
import java.net.Socket;<br />
import java.awt.BorderLayout;<br />
import java.awt.event.ActionEvent;<br />
import java.awt.event.ActionListener;<br />
import javax.swing.JFrame;<br />
import javax.swing.JScrollPane;<br />
import javax.swing.JTextArea;<br />
import javax.swing.JTextField;<br />
import javax.swing.SwingUtilities; </p>
<p>public class Cliente extends JFrame{<br />
    private JTextField campoTexto;<br />
    private JTextArea areaCharla;<br />
    private ObjectOutputStream output;<br />
    private ObjectInputStream input;<br />
    private String mensaje = &#34;&#34;;<br />
    private String ipServidor;<br />
    private Socket cliente;</p>
<p>    public Cliente( String host ){</p>
<p>        super( &#34;Cliente&#34; ); </p>
<p>        ipServidor = host;<br />
        campoTexto = new JTextField();<br />
        campoTexto.setEditable( false );<br />
        campoTexto.addActionListener(<br />
           new ActionListener(){<br />
             public void actionPerformed( ActionEvent event ){<br />
                 enviarDatos( event.getActionCommand() );<br />
                 campoTexto.setText( &#34;&#34; );<br />
              }<br />
           }<br />
        );</p>
<p>        add( campoTexto, BorderLayout.SOUTH ); </p>
<p>        areaCharla = new JTextArea();<br />
        add( new JScrollPane( areaCharla ), BorderLayout.CENTER );<br />
        setSize( 300, 150 );<br />
        setVisible( true );<br />
     }</p>
<p>     public void correrCliente(){<br />
        try{<br />
           conectarAservidor();<br />
           conseguirFlujo();<br />
           procesarConexion();<br />
        }catch ( EOFException eofException ) {<br />
           mostrarMensaje( &#34;\nClient terminated connection&#34; );<br />
        }catch ( IOException ioException ){<br />
           ioException.printStackTrace();<br />
        }finally {<br />
           cerrarConexion();<br />
        }<br />
     }</p>
<p>     private void conectarAservidor() throws IOException{<br />
        mostrarMensaje( &#34;Esperando conectarse&#34; ); </p>
<p>        cliente = new Socket( InetAddress.getByName( ipServidor ), 12346 ); </p>
<p>        mostrarMensaje( &#34;Connected to: &#34; + cliente.getInetAddress().getHostName() );<br />
     }</p>
<p>     private void conseguirFlujo() throws IOException {<br />
        output = new ObjectOutputStream( cliente.getOutputStream() );<br />
        output.flush();<br />
        input = new ObjectInputStream( cliente.getInputStream() );<br />
        mostrarMensaje( &#34;\nExiste conexion con Servidor\n&#34; );<br />
     }</p>
<p>     private void procesarConexion() throws IOException{<br />
        setTextFieldEditable( true );<br />
        do{<br />
           try{<br />
              mensaje = ( String ) input.readObject();<br />
              mostrarMensaje( &#34;\n&#34; + mensaje );<br />
           }catch ( ClassNotFoundException classNotFoundException ){<br />
              mostrarMensaje( &#34;\nUnknown object type received&#34; );<br />
           }</p>
<p>        } while ( !mensaje.equals( &#34;SERVER&#62;&#62;&#62; FINITO&#34; ) );<br />
    }</p>
<p>     private void cerrarConexion(){<br />
        mostrarMensaje( &#34;\nCerrando la conexion&#34; );<br />
        setTextFieldEditable( false );</p>
<p>        try{<br />
           output.close();<br />
           input.close();<br />
           cliente.close();<br />
        }<br />
        catch ( IOException ioException ){<br />
           ioException.printStackTrace();<br />
        }<br />
     }</p>
<p>     private void enviarDatos( String sms )<br />
     {<br />
        try{<br />
           output.writeObject( &#34;CLIENTE&#62;&#62;&#62; &#34; + sms );<br />
           output.flush();<br />
           mostrarMensaje( &#34;\nCLIENTE&#62;&#62;&#62; &#34; + sms );<br />
        }<br />
       catch ( IOException ioException )<br />
        {<br />
           areaCharla.append( &#34;\nNo se puede enviar el mensaje&#34; );<br />
        }<br />
     }</p>
<p>     private void mostrarMensaje( final String mensajeToDisplay ) {<br />
        //SwingUtilities.invokeLater(<br />
          // new Runnable()<br />
           //{<br />
             // public void run()<br />
              //{<br />
                 areaCharla.append( mensajeToDisplay );<br />
              //}<br />
           //}<br />
        //);<br />
     }</p>
<p>     private void setTextFieldEditable( final boolean editable )<br />
     {<br />
        SwingUtilities.invokeLater(<br />
           new Runnable()<br />
           {<br />
              public void run() // sets campoTexto's editability<br />
              {<br />
                 campoTexto.setEditable( editable );<br />
              }<br />
           }<br />
        );<br />
     }<br />
}
</p></description>
		</item>
		<item>
			<title>fiurer87 on "Como programar un chat en Java con interfaz grafica"</title>
			<link>http://www.dudasprogramacion.com/topic/como-programar-un-chat-en-java-con-interfaz-grafica#post-395</link>
			<pubDate>Sat, 15 May 2010 19:03:50 +0000</pubDate>
			<dc:creator>fiurer87</dc:creator>
			<guid isPermaLink="false">395@http://www.dudasprogramacion.com/</guid>
			<description><p>este el codigo para probar el Servidor:<br />
========================================<br />
import javax.swing.JFrame; </p>
<p>public class PruebaServidor{<br />
   public static void main( String args[] ){<br />
      Servidor servidor = new Servidor(); // create server<br />
      servidor.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );<br />
      servidor.iniciarServidor(); // run server application<br />
    } // end main<br />
 }
</p></description>
		</item>
		<item>
			<title>fiurer87 on "Como programar un chat en Java con interfaz grafica"</title>
			<link>http://www.dudasprogramacion.com/topic/como-programar-un-chat-en-java-con-interfaz-grafica#post-394</link>
			<pubDate>Sat, 15 May 2010 19:03:12 +0000</pubDate>
			<dc:creator>fiurer87</dc:creator>
			<guid isPermaLink="false">394@http://www.dudasprogramacion.com/</guid>
			<description><p>Este es el codigo para el servidor:<br />
=================================<br />
import java.io.EOFException;<br />
import java.io.IOException;<br />
import java.io.ObjectInputStream;<br />
import java.io.ObjectOutputStream;<br />
import java.net.ServerSocket;<br />
import java.net.Socket;<br />
import java.awt.BorderLayout;<br />
import java.awt.event.ActionEvent;<br />
import java.awt.event.ActionListener;<br />
import javax.swing.JFrame;<br />
import javax.swing.JScrollPane;<br />
import javax.swing.JTextArea;<br />
import javax.swing.JTextField;<br />
import javax.swing.SwingUtilities;</p>
<p>public class Servidor extends JFrame{<br />
    private JTextField campoEscritura;<br />
    private JTextArea areaCharla;<br />
    private ObjectOutputStream salida;<br />
    private ObjectInputStream entrada;<br />
    private ServerSocket servicio;<br />
    private Socket conexion;<br />
    private int contador;</p>
<p>    //Configuracion de GUI<br />
    public Servidor(){<br />
        super(&#34;Servidor&#34;);<br />
        campoEscritura = new JTextField();<br />
        campoEscritura.setEditable(false);<br />
        campoEscritura.addActionListener(<br />
            new ActionListener(){<br />
                public void actionPerformed(ActionEvent e){<br />
                    enviarDatos(e.getActionCommand());<br />
                    campoEscritura.setText(&#34;&#34;);<br />
                }<br />
            }<br />
        );</p>
<p>        add(campoEscritura, BorderLayout.SOUTH);</p>
<p>        areaCharla = new JTextArea();<br />
        add(new JScrollPane(areaCharla), BorderLayout.CENTER);</p>
<p>        setSize(300,150);<br />
        setVisible(true);<br />
    }</p>
<p>    public void iniciarServidor(){<br />
        try{<br />
            servicio = new ServerSocket(12345, 100);</p>
<p>            while(true){<br />
                try{<br />
                    esperarConexion();<br />
                    getFlujos();<br />
                    procesarConexion();<br />
                }catch(EOFException eof){<br />
                    mostrarMensaje(&#34;Servidor termino la conexion&#34;);<br />
                }finally{<br />
                    cerrarConexion();<br />
                    contador++;<br />
                }<br />
            }<br />
        }catch(IOException io){<br />
            io.printStackTrace();<br />
        }<br />
    }</p>
<p>    private void esperarConexion() throws IOException{<br />
        mostrarMensaje(&#34;Esperando Conexiones&#34;);<br />
        conexion = servicio.accept();<br />
        mostrarMensaje(&#34;Conección &#34;+contador+&#34; recibida de: &#34;+ conexion.getInetAddress().getHostName());<br />
    }</p>
<p>    private void getFlujos() throws IOException{<br />
        salida = new ObjectOutputStream(conexion.getOutputStream());<br />
        salida.flush();</p>
<p>        entrada = new ObjectInputStream(conexion.getInputStream());<br />
        mostrarMensaje(&#34;\n Corren los Flujos de E/S \n&#34;);<br />
    }</p>
<p>    private void procesarConexion() throws IOException{<br />
        String mensaje = &#34;Conexion Establecida&#34;;</p>
<p>        enviarDatos(mensaje);</p>
<p>        setTextFieldEditable(true);</p>
<p>        do{<br />
            try{<br />
                mensaje = (String) entrada.readObject();<br />
                mostrarMensaje(&#34;\n&#34;+mensaje);<br />
            }catch(ClassNotFoundException cnfe){<br />
                mostrarMensaje(&#34;\n Tipo de Objeto desconocido fue recibido&#34;);<br />
            }<br />
        } while(!mensaje.equals(&#34;CLIENT&#62;&#62;&#62; FINITO&#34;));<br />
    }</p>
<p>    private void cerrarConexion(){<br />
        mostrarMensaje(&#34;\nConexión cerrada\n&#34;);<br />
        setTextFieldEditable(false);</p>
<p>        try{<br />
            salida.close();<br />
            entrada.close();<br />
            conexion.close();<br />
        } catch(IOException io){<br />
            io.printStackTrace();<br />
        }<br />
    }</p>
<p>    private void enviarDatos(String mensaje){<br />
        try{<br />
            salida.writeObject(&#34;\nSERVER&#62;&#62;&#62; &#34;+mensaje);<br />
            salida.flush();<br />
            mostrarMensaje(&#34;\nSERVER&#62;&#62;&#62; &#34;+ mensaje);<br />
        }<br />
        catch(IOException io){<br />
            areaCharla.append(&#34;\nError al escribir el objeto&#34;);<br />
        }<br />
    }</p>
<p>    private void mostrarMensaje(final String mensajeAmostrar){<br />
        SwingUtilities.invokeLater(<br />
            new Runnable(){<br />
                public void run(){<br />
                    areaCharla.append(mensajeAmostrar);<br />
                }<br />
            }<br />
        );<br />
    }</p>
<p>    private void setTextFieldEditable(final boolean editable){<br />
        SwingUtilities.invokeLater(<br />
            new Runnable(){<br />
                public void run(){<br />
                    campoEscritura.setEditable(editable);<br />
                }<br />
            }<br />
        );<br />
    }<br />
}
</p></description>
		</item>
		<item>
			<title>fiurer87 on "Asignar acciones a botones"</title>
			<link>http://www.dudasprogramacion.com/topic/asignar-acciones-a-botones#post-391</link>
			<pubDate>Sat, 15 May 2010 15:37:38 +0000</pubDate>
			<dc:creator>fiurer87</dc:creator>
			<guid isPermaLink="false">391@http://www.dudasprogramacion.com/</guid>
			<description><p>Hola,<br />
(Usare el metodo de clase anidada o interna)<br />
Para asignar una accion a un boton es la siguiente:<br />
//estas son las clases necesarias para mi ejemplo<br />
import javax.swing.JOptionPane;<br />
import javax.swing.JButton;<br />
import java.awt.event.ActionEvent;<br />
import java.awt.event.ActionListener;</p>
<p>//este el codigo necesario para dar accion a un boton<br />
JButton unBoton = new JButton(&#34;Presioname&#34;);<br />
unBoton.addActionListener(new ActionListener(){<br />
      public void actionPerformed(ActionEvent ae){<br />
            //aqui pones lo que quieras hacer al presionar el boton<br />
            //Yo pondre un aviso que diga Presinado<br />
            JOptionPane.showMessageDialog(null, &#34;Presionado&#34;);<br />
      }<br />
});</p>
<p>Espero te sea de ayuda, aunq respondi tarde :)</p>
<p>Saludos
</p></description>
		</item>
		<item>
			<title>Torres on "¿Obtener las posición del cursor en un JTextField en Java?"</title>
			<link>http://www.dudasprogramacion.com/topic/%c2%bfobtener-las-posicion-del-cursor-en-un-jtextfield-en-java-1#post-318</link>
			<pubDate>Thu, 11 Feb 2010 16:48:03 +0000</pubDate>
			<dc:creator>Torres</dc:creator>
			<guid isPermaLink="false">318@http://www.dudasprogramacion.com/</guid>
			<description><p>Buenas, </p>
<p>JTextField.getCaretPosition() te devuelve un entero con la posición el cursor.</p>
<p><a href="http://java.sun.com/javase/6/docs/api/javax/swing/text/JTextComponent.html#getCaretPosition%28%29" rel="nofollow">http://java.sun.com/javase/6/docs/api/javax/swing/text/JTextComponent.html#getCaretPosition%28%29</a></p>
<p>Un saludo!
</p></description>
		</item>
		<item>
			<title>Edmond on "¿Obtener las posición del cursor en un JTextField en Java?"</title>
			<link>http://www.dudasprogramacion.com/topic/%c2%bfobtener-las-posicion-del-cursor-en-un-jtextfield-en-java-1#post-315</link>
			<pubDate>Tue, 09 Feb 2010 17:48:53 +0000</pubDate>
			<dc:creator>Edmond</dc:creator>
			<guid isPermaLink="false">315@http://www.dudasprogramacion.com/</guid>
			<description><p>Ejemplo:<br />
Suponiendo el cursor sea &#34;&#124;&#34;<br />
En el JTexlField (en ejecución) : &#34;No sé que&#124; todo&#34;<br />
Quisiera sabes que desde un JButton se agrege cualquier text en esa posición, suponiendo que el JButton agregue &#34;OOO&#34;<br />
El JTextField quedaría: &#34;No sé queOOO todo&#34;<br />
Espero su ayuda...<br />
saludos
</p></description>
		</item>
		<item>
			<title>Edmond on "¿Obtener las posición del cursor en un JTextField en Java?"</title>
			<link>http://www.dudasprogramacion.com/topic/%c2%bfobtener-las-posicion-del-cursor-en-un-jtextfield-en-java#post-314</link>
			<pubDate>Tue, 09 Feb 2010 17:47:14 +0000</pubDate>
			<dc:creator>Edmond</dc:creator>
			<guid isPermaLink="false">314@http://www.dudasprogramacion.com/</guid>
			<description><p>Ejemplo:<br />
Suponiendo el cursor sea &#34;&#124;&#34;<br />
En el JTexlField (en ejecución) : &#34;No sé que&#124; todo&#34;<br />
Quisiera sabes que desde un JButton se agrege cualquier text en esa posición, suponiendo que el JButton agregue &#34;OOO&#34;<br />
El JTextField quedaría: &#34;No sé queOOO todo&#34;<br />
Espero su ayuda...<br />
saludos
</p></description>
		</item>

	</channel>
</rss>

