sábado, 30 de junio de 2012

COMO USAR DIALOGO DE COLOR "JColorChooser"

Esta Vez Aprenderemos a usar el DIALOGO de COLOR "JFileChooser"

EJERCICIO:
  • RESULTADO

  • CODIGO FUENTE

/**
 *
 *  DUDAS SOBRE ESTE CODIGO, shamirdhc31@gmail.com
 */

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class SELECCION_COLOR extends JFrame implements ActionListener
{
    public JPanel PANEL_COLOR;
    public JColorChooser DIALOGO_COLOR;
    public JButton BOTON_COLOR;
    public Color COLOR_SELECCIONADO;

    public SELECCION_COLOR()
    {
        super();
        this.setSize(500,450);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        FlowLayout DISTRIBUIDOR = new FlowLayout(FlowLayout.CENTER);
        this.setLayout(DISTRIBUIDOR);

        this.BOTON_COLOR = new JButton("SELECCIONAR COLOR");
        this.BOTON_COLOR.addActionListener(this);

        this.PANEL_COLOR = new JPanel();
        this.PANEL_COLOR.setPreferredSize(new Dimension(400,350));

        this.add(this.BOTON_COLOR);
        this.add(this.PANEL_COLOR);
    }
    public void actionPerformed(ActionEvent EVT)
    {
        this.DIALOGO_COLOR = new JColorChooser();
        this.COLOR_SELECCIONADO = this.DIALOGO_COLOR.showDialog(null,"SELECCIONE UN COLOR",Color.BLACK);
        this.PANEL_COLOR.setBackground(this.COLOR_SELECCIONADO);
    }
    public static void main(String[] ARGUMENTOS)
    {
        SELECCION_COLOR CUADRO_COLOR = new SELECCION_COLOR();
        CUADRO_COLOR.setVisible(true);
    }
}

DALE CLICK EN LA IMAGEN PARA BAJARTE EL PROYECTO CON EL EJERCICIO


IMPORTANTE : "TODOS LOS CODIGOS INDICADOS AQUI SON ESCRITOS POR MI, ASI QUE CUALQUIER DUDA O EJERCICIO QUE NO PUEDAN RESOLVER, NO DUDEN EN MANDARME UN E-MAIL A MI CORREO"
shamirdhc31@gmail.com

6 comentarios:

  1. mantnt en contacto conmigo va.. a veces tngo problemillas con eso o_O

    ResponderEliminar
    Respuestas
    1. claro amigo... tu solo mandame tus problems a mi cuenta shamirdhc31@gmail.com... que yo te ayudo con lo que pueda..

      Eliminar
  2. hola como puedo usar el jcolorchooser para cambiar el color a un jpanel en un jframe

    ResponderEliminar
  3. Thanks for sharing, nice post! Post really provice useful information!

    Giaonhan247 chuyên dịch vụ chuyên dịch vụ mua hàng Mỹ uy tín, dịch vụ đặt hàng mỹ tại Việt Nam và vận chuyển gửi hàng đi Mỹ giá rẻ tại TPHCM, Hà Nội và toàn quốc.

    ResponderEliminar