@@ -0,0 +1,1654 @@
+package edu.kit.iks.Cryptographics.DiffieHellman.Demonstration;%0A%0Aimport java.awt.Color;%0Aimport java.awt.Graphics;%0Aimport java.awt.Graphics2D;%0Aimport java.awt.RenderingHints;%0Aimport java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionListener;%0Aimport java.awt.geom.Ellipse2D;%0A%0Aimport javax.swing.JPanel;%0Aimport javax.swing.Timer;%0A%0Apublic class ColorChannel extends JPanel %7B%0A%0A%09/**%0A%09 * %0A%09 */%0A%09private static final long serialVersionUID = 4073013433018353584L;%0A%09%0A%09private int x1, y1, x2, y2;%0A%09%0A%09public ColorChannel(int a1, int b1, int a2, int b2) %7B%0A%09%09this.x1 = a1;%0A%09%09this.y1 = b1;%0A%09%09this.x2 = a2;%0A%09%09this.y2 = b2;%0A%09%09Timer timer = new Timer(50, new ActionListener() %7B%0A%09%09%09%0A%09%09%09@Override%0A%09%09%09public void actionPerformed(ActionEvent arg0) %7B%0A%09%09%09%09if(x1 %3C 750) %7B%0A%09%09%09%09%09x1 += 3;%0A%09%09%09%09%09if (x1 %3E 600 && y2 %3E 63) %7B%0A%09%09%09%09%09%09y2 -= 3;%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%0A%09%09%09%09repaint();%0A%09%09%09%7D%0A%09%09%7D);%0A%09%09timer.start();%0A%09%09%0A%09%7D%0A%09%0A%09@Override%0A%09protected void paintComponent(Graphics g) %7B%0A%09%09// TODO remove hardcoded colors and do it dynamically%0A%09%09Graphics2D g2 = (Graphics2D) g;%0A%09%09g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);%0A%09%09drawChannel(g2, 450, 800, 180, 60);%0A%09%09Ellipse2D.Double ellip = new Ellipse2D.Double(x1, y1, 50, 50);%0A%09%09g2.setPaint(Color.BLUE);%0A%09%09g2.fill(ellip);%0A%09%09if(x1 %3E 600) %7B%0A%09%09%09Ellipse2D.Double ellip2 = new Ellipse2D.Double(x2, y2, 50, 50);%0A%09%09%09g2.fill(ellip2);%0A%09%09%7D%0A%09%09%0A%09%7D%0A%0A%09private void drawChannel(Graphics2D g2, int x1, int x2, int x3, int x4) %7B%0A%09%09g2.drawLine(x1, x3, x2, x3);%0A%09%09g2.drawLine((x1+x2)/2, x4, (x1+x2)/2, x3);%0A%09%09g2.drawString(%22Alice%22, x1-50, x3);%0A%09%09g2.drawString(%22Bob%22, x2+10, x3);%0A%09%09g2.drawString(%22Eve%22, (x1+x2)/2 - 15, x4-10);%0A%09%7D%0A%0A%7D%0A

add reusable channel view class