EJERCICIO:
- 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