package edu.kit.iks.Cryptographics.DiffieHellman.Experiment;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;

import edu.kit.iks.Cryptographics.DiffieHellman.Demonstration.ColorChannel;
import edu.kit.iks.Cryptographics.DiffieHellman.Demonstration.ColorMix;

public class ChoosePublicColorView extends JPanel {

	private static final long serialVersionUID = 5764374133753732451L;
	
	private JLabel choosePublicLbl;

	private ColorChannel cc;

	private ColorMix cm;
	
	public ChoosePublicColorView() {
		super();
		GridBagConstraints gbc = new GridBagConstraints();
		GridBagLayout layout = new GridBagLayout();
		this.setLayout(layout);
		
		this.choosePublicLbl = new JLabel();
		this.choosePublicLbl.setText("<html><div style=\"width:120px\">Alice chooses a public color and sends it to Bob" +
				"Eve listens to the channel and gets a copy</div></html>");
		gbc.weightx = 0.1;
		gbc.weighty = 0.1;
		gbc.gridx = 1;
		gbc.gridy = 2;
		this.add(choosePublicLbl, gbc);
		this.cc = new ColorChannel(new Dimension(700, 200), 50);
		
		gbc.weightx = 0.1;
		gbc.weighty = 0.1;
		gbc.gridx = 1;
		gbc.gridy = 0;
		gbc.fill = GridBagConstraints.BOTH;
		this.add(this.cc, gbc);
		
		this.cm = new ColorMix(50, new Dimension(200, 200));
		
		gbc.weightx = 0.1;
		gbc.weighty = 0.1;
		gbc.gridx = 2;
		gbc.gridy = 0;
		this.add(this.cm, gbc);
	}

}

@@ -51,24 +51,47 @@
 xperiment;%0A%0A
+import java.awt.Color;%0A
 import java.
@@ -105,16 +105,16 @@
 ension;%0A
-
 import j
@@ -300,24 +300,100 @@
 lorChannel;%0A
+import edu.kit.iks.Cryptographics.DiffieHellman.Demonstration.ColorChooser;%0A
 import edu.k
@@ -661,16 +661,216 @@
 x cm;%0A%09%0A
+%09private ColorChooser chooser;%0A%09%0A%09private Color%5B%5D toChooseFrom = %7BColor.BLUE, Color.CYAN,%0A%09%09%09Color.DARK_GRAY, Color.GREEN, Color.MAGENTA,%0A%09%09%09Color.ORANGE, Color.PINK, Color.RED,%0A%09%09%09Color.YELLOW%0A%09%7D;%0A%09%0A
 %09public 
@@ -1703,16 +1703,16 @@
 dy = 0;%0A
-
 %09%09this.a
@@ -1729,14 +1729,211 @@
 , gbc);%0A
+%09%09%0A%09%09this.chooser = new ColorChooser(new Dimension(50, 50), Color.BLUE, toChooseFrom);%0A%09%09%0A%09%09gbc.weightx = 0.1;%0A%09%09gbc.weightx = 0.1;%0A%09%09gbc.gridx = 3;%0A%09%09gbc.gridy = 1;%0A%09%09this.add(this.chooser, gbc);%0A
 %09%7D%0A%0A%7D%0A

add color chooser to choosepubliccolorview