Created
September 10, 2014 19:45
-
-
Save Pompeu/d99680688945312d8f1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package bntcolorchoise; | |
import java.awt.Color; | |
import java.awt.GridBagLayout; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import javax.swing.JButton; | |
import javax.swing.JColorChooser; | |
import javax.swing.JFrame; | |
import javax.swing.JOptionPane; | |
/** | |
* | |
* @author pompeu | |
*/ | |
public class BntColorChoise extends JFrame { | |
private final JButton btnAbrir = new JButton("Abrir"); | |
private final JColorChooser pegarCor = new JColorChooser(Color.BLACK); | |
public BntColorChoise() { | |
super("Bnt color Choice"); | |
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
setSize(800,600); | |
setVisible(true); | |
setLayout(new GridBagLayout()); | |
add(btnAbrir); | |
add(pegarCor); | |
btnAbrir.addActionListener(new ActionListener() { | |
@Override | |
public void actionPerformed(ActionEvent e) { | |
btnAbrir.setBackground(pegarCor.getColor()); | |
} | |
}); | |
} | |
public static void main(String[] args) { | |
new BntColorChoise(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment