Codigo:
// Tabla de selector de colores: JColorChooser
package colores1;
import java.awt.Color;import javax.swing.JColorChooser;
public class Colores1 extends javax.swing.JFrame {
public Colores1() {
initComponents();
this.setLocationRelativeTo(null); //centrar pantalla
}
private void initComponents() {
//Codigo generado por Netbeans al crear la interface grafica manualmente...
}
private void JButtonCargarColoresActionPerformed(java.awt.event.ActionEvent evt) {
Color c = JColorChooser.showDialog(this, "Seleccion color" , Color.white);
if(c != null) getContentPane().setBackground(c);
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable(){
public void run() {
new Colores1().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton JButtonCargarColores;
// End of variables declaration
}
Resultado:
·
No hay comentarios:
Publicar un comentario