// Path: src/heroesgrave/spade/gui/colorchooser/event/ColourEventBroadcaster.java
// public interface ColourEventBroadcaster
// {
// 	public void addColorListener(ColourListener c);
// 	
// 	public void removeColorListener(ColourListener c);
// 	
// 	public void broadcastChanges(ColourListener source);
// 	
// 	public void makeChange(Object source, Channel channel, int val, boolean primary);
// }
// 
// Path: src/heroesgrave/spade/gui/colorchooser/event/ColourListener.java
// public interface ColourListener extends EventListener
// {
// 	public void changeColor(int r, int g, int b, int h, int s, int v, int a, boolean primary);
// }


import java.awt.Graphics2D;
import java.awt.Stroke;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.JComponent;
import static heroesgrave.spade.gui.colorchooser.Channel.Alpha;
import static heroesgrave.spade.gui.colorchooser.Channel.Blue;
import static heroesgrave.spade.gui.colorchooser.Channel.Green;
import static heroesgrave.spade.gui.colorchooser.Channel.Red;
import heroesgrave.spade.gui.colorchooser.event.ColourEventBroadcaster;
import heroesgrave.spade.gui.colorchooser.event.ColourListener;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
		setPreferredSize(getSize());
		setMinimumSize(getSize());
		setMaximumSize(getSize());
	}
	
	@Override
	public void paint(Graphics g)
	{
		g.clearRect(1, 1, getWidth() - 1, getHeight() - 1);
		
		g.setColor(Color.darkGray);
		g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
		
		final int off = 1;
		
		int cols = mode == PaletteMode.Minimized ? 8 : 12;
		int rows = mode == PaletteMode.Extended ? 6 : 3;
		
		for(int y = 0; y < rows; y++)
			for(int x = 0; x < cols; x++)
			{
				int xc = x * SWATCH_SIZE;
				int yc = y * SWATCH_SIZE;
				
				g.setColor(bg1);
				g.fillRect(off + xc, off + yc, SWATCH_SIZE / 2, SWATCH_SIZE / 2);
				g.fillRect(off + xc + SWATCH_SIZE / 2, off + yc + SWATCH_SIZE / 2, SWATCH_SIZE / 2, SWATCH_SIZE / 2);
				
				{
					int color = colors[x + y * cols];
// Path: src/heroesgrave/spade/gui/colorchooser/event/ColourEventBroadcaster.java
// public interface ColourEventBroadcaster
// {
// 	public void addColorListener(ColourListener c);
// 	
// 	public void removeColorListener(ColourListener c);
// 	
// 	public void broadcastChanges(ColourListener source);
// 	
// 	public void makeChange(Object source, Channel channel, int val, boolean primary);
// }
// 
// Path: src/heroesgrave/spade/gui/colorchooser/event/ColourListener.java
// public interface ColourListener extends EventListener
// {
// 	public void changeColor(int r, int g, int b, int h, int s, int v, int a, boolean primary);
// }


// Path: src/heroesgrave/spade/gui/colorchooser/PalettePanel.java
import java.awt.Graphics2D;
import java.awt.Stroke;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.swing.JComponent;
import static heroesgrave.spade.gui.colorchooser.Channel.Alpha;
import static heroesgrave.spade.gui.colorchooser.Channel.Blue;
import static heroesgrave.spade.gui.colorchooser.Channel.Green;
import static heroesgrave.spade.gui.colorchooser.Channel.Red;
import heroesgrave.spade.gui.colorchooser.event.ColourEventBroadcaster;
import heroesgrave.spade.gui.colorchooser.event.ColourListener;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;

		setPreferredSize(getSize());
		setMinimumSize(getSize());
		setMaximumSize(getSize());
	}
	
	@Override
	public void paint(Graphics g)
	{
		g.clearRect(1, 1, getWidth() - 1, getHeight() - 1);
		
		g.setColor(Color.darkGray);
		g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
		
		final int off = 1;
		
		int cols = mode == PaletteMode.Minimized ? 8 : 12;
		int rows = mode == PaletteMode.Extended ? 6 : 3;
		
		for(int y = 0; y < rows; y++)
			for(int x = 0; x < cols; x++)
			{
				int xc = x * SWATCH_SIZE;
				int yc = y * SWATCH_SIZE;
				
				g.setColor(bg1);
				g.fillRect(off + xc, off + yc, SWATCH_SIZE / 2, SWATCH_SIZE / 2);
				g.fillRect(off + xc + SWATCH_SIZE / 2, off + yc + SWATCH_SIZE / 2, SWATCH_SIZE / 2, SWATCH_SIZE / 2);
				
				{
					int color = colors[x + y * cols];
					int a = (color >> 24) & 0xFF;