import java.awt.Label; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JPanel; import javax.swing.JButton; /** * The ColorBox class is a color pallette. It stores the color the user clicked * with the right and left mouse button. It also contains a set of preset colors * which can be changed with the advanced feature. **/ public class ColorBox extends JPanel { public static Label foreGround, backGround; public static int selectedSwatchX, selectedSwatchY; public static ColorLabel[][] colorPal; private JButton clrPnlBtn; private ColorPanel clrPnl; /** Creates a default ColorBox. **/ public ColorBox() { // sets the layout to null and sets a size to the color box setLayout(null); setSize(350,120); // instantiates the Mouse Left and Mouse Right color labels setForeBack(); // instantiates the Color Panel clrPnl = new ColorPanel(); // instantiates a button that calls for advanced settings, sets the size // and the x,y coordinates and adds it to screen clrPnlBtn = new JButton("Advanced"); clrPnlBtn.setBounds(100,65,100,20); add(clrPnlBtn); clrPnlBtn.addActionListener(new AdvancedListener()); // instantiates the color label and it finds its corresponding color // depending on its x and y coordinates colorPal = new ColorLabel[2][14]; for(int i=0;i