summaryrefslogtreecommitdiffstats
path: root/Master/Kryptografie/krypto1/KryptTool.java
blob: 8788fec81f20286aa9ab7fd04d63a21cf403e40c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JLabel;
import java.awt.GridBagLayout;
import javax.swing.JButton;
import java.awt.GridBagConstraints;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import java.awt.Dimension;
import javax.swing.JList;
import java.awt.event.*;
import java.util.Observer;
import java.util.Observable;
import javax.swing.JRadioButton;
import javax.swing.*;
import java.awt.GridLayout;
import java.awt.CardLayout;
import java.awt.Insets;
import java.awt.Rectangle;

public class KryptTool extends JFrame implements Observer,WindowListener {

	KryptModel myKM = new KryptModel();  //  @jve:decl-index=0:
	KryptArith myKA = new KryptArith();
	
	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;

	private JMenuBar jJMenuBar = null;

	private JMenu jMenu = null;

	private JMenuItem jMenuItem = null;

	private JPanel jPanel = null;

	private JButton jButton = null;

	private JButton jButton1 = null;

	private JLabel jLabel = null;

	private JTextArea jTextArea = null;

	private JPanel jPanel1 = null;

	private JLabel jLabel1 = null;

	private JButton jButton2 = null;

	private JButton jButton3 = null;

	private JTextArea jTextArea1 = null;

	private JPanel jPanel2 = null;

	private JButton jButton4 = null;

	private JButton jButton5 = null;

	private JButton jButton6 = null;

	private JLabel jLabel2 = null;

	private JLabel jLabel3 = null;

	private JTextField jTextField = null;

	private JLabel jLabel4 = null;

	private JTextField jTextField1 = null;

	private JLabel jLabel5 = null;

	private JTextField jTextField2 = null;

	private JLabel jLabel6 = null;

	private JLabel jLabel7 = null;

	private JLabel jLabel8 = null;

	private JLabel jLabel9 = null;

	private JLabel jLabel10 = null;

	private JLabel jLabel11 = null;

	private JTextField jTextField3 = null;

	private JTextField jTextField4 = null;

	private JTextField jTextField5 = null;

	private JTextField jTextField6 = null;

	private JButton jButton7 = null;
	private JRadioButton jRadioButton = null;
	private JLabel jLabel12 = null;
	private JRadioButton jRadioButton1 = null;
	private ButtonGroup bg = null;
	private JPanel jPanel4 = null;
	private JLabel jLabel14 = null;
	private JLabel jLabel15 = null;
	private JLabel jLabel16 = null;
	private JLabel jLabel17 = null;
	private JButton jButton8 = null;
	private JPanel jPanel5 = null;
	private JButton jButton9 = null;
	private JLabel jLabel13 = null;
	//private Dimension tfDim=null;
	/**
	 * This is the default constructor
	 */
	public KryptTool() {
		super();
		initialize();
	}

	public void update(Observable o, Object arg) {
		//System.out.println("myKM updated");
		jTextField.setText(Integer.toString(myKM.getkey_t()));
		jTextField1.setText(Integer.toString(myKM.getkey_s()));
		jTextField2.setText(Integer.toString(myKM.getmod()));
		jTextArea.setText(myKM.getplain());
		jTextArea1.setText(myKM.getcipher());
		//myKM.calcModInv();
		jLabel17.setText(Integer.toString(myKM.getModInv()));
		jLabel15.setText(myKM.getStatus());
	}
	public void windowClosing(WindowEvent e) {
		exitKT();
	}
	public void windowClosed(WindowEvent e) {
	}
	public void windowOpened(WindowEvent e) {
	}
	public void windowIconified(WindowEvent e) {
	}
	public void windowDeiconified(WindowEvent e) {
	}
	public void windowActivated(WindowEvent e) {
	}
	public void windowDeactivated(WindowEvent e) {
	}
	public void windowGainedFocus(WindowEvent e) {
	}
	public void windowLostFocus(WindowEvent e) {
	}
	public void windowStateChanged(WindowEvent e) {
	}
	
	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		//tfDim = new Dimension(20,60);
		this.setSize(760, 462);
		this.setJMenuBar(getJJMenuBar());
		this.setContentPane(getJContentPane());
		this.setTitle("KryptTool");
		myKM.addObserver(this);
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			GridBagConstraints gridBagConstraints18 = new GridBagConstraints();
			gridBagConstraints18.gridx = 0;
			gridBagConstraints18.ipady = 318;
			gridBagConstraints18.gridy = 1;
			GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
			gridBagConstraints17.gridx = 2;
			gridBagConstraints17.ipady = 308;
			gridBagConstraints17.gridy = 1;
			GridBagConstraints gridBagConstraints16 = new GridBagConstraints();
			gridBagConstraints16.gridx = 1;
			gridBagConstraints16.ipadx = 133;
			gridBagConstraints16.ipady = 348;
			gridBagConstraints16.gridy = 1;
			GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
			gridBagConstraints15.gridwidth = 3;
			gridBagConstraints15.gridy = 2;
			gridBagConstraints15.ipadx = 658;
			gridBagConstraints15.gridx = 0;
			GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
			gridBagConstraints14.gridwidth = 3;
			gridBagConstraints14.gridy = 0;
			gridBagConstraints14.ipadx = -1295;
			gridBagConstraints14.gridx = 0;
			jContentPane = new JPanel();
			jContentPane.setLayout(new GridBagLayout());
			jContentPane.add(getJPanel2(), gridBagConstraints14);
			jContentPane.add(getJPanel4(), gridBagConstraints15);
			jContentPane.add(getJPanel5(), gridBagConstraints16);
			jContentPane.add(getJPanel(), gridBagConstraints17);
			jContentPane.add(getJPanel1(), gridBagConstraints18);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jJMenuBar	
	 * 	
	 * @return javax.swing.JMenuBar	
	 */
	private JMenuBar getJJMenuBar() {
		if (jJMenuBar == null) {
			jJMenuBar = new JMenuBar();
			jJMenuBar.add(getJMenu());
		}
		return jJMenuBar;
	}

	/**
	 * This method initializes jMenu	
	 * 	
	 * @return javax.swing.JMenu	
	 */
	private JMenu getJMenu() {
		if (jMenu == null) {
			jMenu = new JMenu();
			jMenu.setText("File");
			jMenu.add(getJMenuItem());
		}
		return jMenu;
	}

	/**
	 * This method initializes jMenuItem	
	 * 	
	 * @return javax.swing.JMenuItem	
	 */
	private JMenuItem getJMenuItem() {
		if (jMenuItem == null) {
			jMenuItem = new JMenuItem();
			jMenuItem.setText("Exit");
			jMenuItem.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					exitKT();
				}
			});
		}
		return jMenuItem;
	}

	/**
	 * This method initializes jPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel() {
		if (jPanel == null) {
			GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
			gridBagConstraints41.gridx = 0;
			gridBagConstraints41.gridy = 1;
			GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
			gridBagConstraints3.gridy = 0;
			gridBagConstraints3.gridx = 0;
			GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
			gridBagConstraints2.gridy = 2;
			gridBagConstraints2.gridx = 1;
			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
			gridBagConstraints1.gridy = 1;
			gridBagConstraints1.gridx = 1;
			jLabel = new JLabel();
			jLabel.setText("Plain Text");
			jPanel = new JPanel();
			jPanel.setLayout(new GridBagLayout());
			jPanel.add(getJButton(), gridBagConstraints1);
			jPanel.add(getJButton1(), gridBagConstraints2);
			jPanel.add(jLabel, gridBagConstraints3);
			jPanel.add(getJTextArea(), gridBagConstraints41);
		}
		return jPanel;
	}

	/**
	 * This method initializes jButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton() {
		if (jButton == null) {
			jButton = new JButton();
			jButton.setText("Open");
		}
		return jButton;
	}

	/**
	 * This method initializes jButton1	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton1() {
		if (jButton1 == null) {
			jButton1 = new JButton();
			jButton1.setText("Save");
		}
		return jButton1;
	}

	/**
	 * This method initializes jTextArea	
	 * 	
	 * @return javax.swing.JTextArea	
	 */
	private JTextArea getJTextArea() {
		if (jTextArea == null) {
			jTextArea = new JTextArea();
			jTextArea.setText("Enter plain text here...");
			jTextArea.addFocusListener(new java.awt.event.FocusListener() {
				public void focusLost(java.awt.event.FocusEvent e) {
					myKM.setPlain(jTextArea.getText());
				}
				public void focusGained(java.awt.event.FocusEvent e) {
				}
			});
			
		}
		return jTextArea;
	}

	/**
	 * This method initializes jPanel1	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel1() {
		if (jPanel1 == null) {
			GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
			gridBagConstraints6.fill = GridBagConstraints.BOTH;
			gridBagConstraints6.gridy = 2;
			gridBagConstraints6.weightx = 1.0;
			gridBagConstraints6.weighty = 1.0;
			gridBagConstraints6.gridwidth = 1;
			gridBagConstraints6.gridx = 0;
			GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
			gridBagConstraints5.gridx = 1;
			gridBagConstraints5.gridy = 1;
			GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
			gridBagConstraints4.gridx = 0;
			gridBagConstraints4.gridy = 1;
			jLabel1 = new JLabel();
			jLabel1.setText("Cipher");
			jPanel1 = new JPanel();
			jPanel1.setLayout(new GridBagLayout());
			jPanel1.add(jLabel1, new GridBagConstraints());
			jPanel1.add(getJButton2(), gridBagConstraints4);
			jPanel1.add(getJButton3(), gridBagConstraints5);
			jPanel1.add(getJTextArea1(), gridBagConstraints6);
		}
		return jPanel1;
	}

	/**
	 * This method initializes jButton2	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton2() {
		if (jButton2 == null) {
			jButton2 = new JButton();
			jButton2.setText("Open");
		}
		return jButton2;
	}

	/**
	 * This method initializes jButton3	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton3() {
		if (jButton3 == null) {
			jButton3 = new JButton();
			jButton3.setText("Save");
		}
		return jButton3;
	}

	/**
	 * This method initializes jTextArea1	
	 * 	
	 * @return javax.swing.JTextArea	
	 */
	private JTextArea getJTextArea1() {
		if (jTextArea1 == null) {
			jTextArea1 = new JTextArea();
			jTextArea1.setText("Enter cipher here...");
			jTextArea1.addFocusListener(new java.awt.event.FocusListener() {
				public void focusLost(java.awt.event.FocusEvent e) {
					myKM.setCipher(jTextArea1.getText());
				}
				public void focusGained(java.awt.event.FocusEvent e) {
				}
			});
		}
		return jTextArea1;
	}

	/**
	 * This method initializes jPanel2	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel2() {
		if (jPanel2 == null) {
			
			GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
			gridBagConstraints21.gridheight = 1;
			GridBagConstraints gridBagConstraints19 = new GridBagConstraints();
			gridBagConstraints19.gridx = 7;
			gridBagConstraints19.gridy = 1;
			GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
			gridBagConstraints13.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints13.weightx = 1.0;
			GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
			gridBagConstraints12.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints12.weightx = 1.0;
			jLabel13 = new JLabel();
			jLabel13.setText("Vignere-Chiffre");
			GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
			gridBagConstraints10.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints10.weightx = 1.0;
			GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
			gridBagConstraints9.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints9.weightx = 1.0;
			GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
			gridBagConstraints8.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints8.weightx = 1.0;
			GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
			gridBagConstraints7.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints7.weightx = 1.0;
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
			gridBagConstraints.fill = GridBagConstraints.VERTICAL;
			gridBagConstraints.weightx = 1.0;
			jLabel17 = new JLabel();
			jLabel17.setText("undefined");
			jLabel16 = new JLabel();
			jLabel16.setText("Inverse:");
			bg = new ButtonGroup();
			jLabel12 = new JLabel();
			jLabel12.setText("Tausch-Chiffre");
			jLabel11 = new JLabel();
			jLabel11.setText("P2:");
			jLabel10 = new JLabel();
			jLabel10.setText("P1:");
			jLabel9 = new JLabel();
			jLabel9.setText("C2:");
			jLabel8 = new JLabel();
			jLabel8.setText("C1:");
			jLabel7 = new JLabel();
			jLabel7.setText("Method");
			jLabel6 = new JLabel();
			jLabel6.setText("Known Plain Text Attack");
			jLabel5 = new JLabel();
			jLabel5.setText("Modulus m:");
			jLabel4 = new JLabel();
			jLabel4.setText("Key s:");
			jLabel3 = new JLabel();
			jLabel3.setText("Key t:");
			jLabel2 = new JLabel();
			jLabel2.setText("Krypto parameter");
			jPanel2 = new JPanel();
			jPanel2.setLayout(new GridBagLayout());

			jPanel2.add(jLabel2, gridBagConstraints21);
			jPanel2.add(jLabel16, new GridBagConstraints());
			jPanel2.add(getJButton8(), new GridBagConstraints());
			jPanel2.add(jLabel3, new GridBagConstraints());
			jPanel2.add(jLabel4, new GridBagConstraints());
			jPanel2.add(getJTextField2(), gridBagConstraints);
			jPanel2.add(jLabel10, new GridBagConstraints());
			jPanel2.add(jLabel5, gridBagConstraints19);
			jPanel2.add(jLabel6, new GridBagConstraints());
			jPanel2.add(jLabel7, new GridBagConstraints());
			jPanel2.add(getJButton9(), new GridBagConstraints());
			jPanel2.add(jLabel8, new GridBagConstraints());
			jPanel2.add(jLabel9, new GridBagConstraints());
			jPanel2.add(getJTextField3(), gridBagConstraints7);
			jPanel2.add(getJTextField4(), gridBagConstraints8);
			jPanel2.add(getJTextField5(), gridBagConstraints9);
			jPanel2.add(getJTextField6(), gridBagConstraints10);
			jPanel2.add(getJButton7(), new GridBagConstraints());
			jPanel2.add(getJRadioButton(), new GridBagConstraints());
			jPanel2.add(jLabel13, new GridBagConstraints());
			jPanel2.add(getJTextField1(), gridBagConstraints12);
			jPanel2.add(jLabel11, new GridBagConstraints());
			jPanel2.add(jLabel12, new GridBagConstraints());
			jPanel2.add(getJRadioButton1(), new GridBagConstraints());
			jPanel2.add(getJTextField(), gridBagConstraints13);
			jPanel2.add(jLabel17, new GridBagConstraints());
			bg.add(jRadioButton);
			bg.add(jRadioButton1);
		}
		return jPanel2;
	}

	/**
	 * This method initializes jButton4	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton4() {
		if (jButton4 == null) {
			jButton4 = new JButton();
			jButton4.setText("Encrypt");
			jButton4.setName("jButton4");
			jButton4.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					myKM.encrypt();
				}
			});
		}
		return jButton4;
	}

	/**
	 * This method initializes jButton5	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton5() {
		if (jButton5 == null) {
			jButton5 = new JButton();
			jButton5.setText("Decrypt");
			jButton5.setName("jButton5");
			jButton5.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					myKM.decrypt();
				}
			});
		}
		return jButton5;
	}

	/**
	 * This method initializes jButton6	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton6() {
		if (jButton6 == null) {
			jButton6 = new JButton();
			jButton6.setText("Attack");
			jButton6.setName("jButton6");
			jButton6.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					myKM.attack();
				}
			});
		}
		return jButton6;
	}

	/**
	 * This method initializes jTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField() {
		if (jTextField == null) {
			jTextField = new JTextField("key t...",10);
			jTextField.setToolTipText("Enter key t here");
			IntVerifier iv = new IntVerifier();
			jTextField.setInputVerifier(iv);
			jTextField.addFocusListener(new java.awt.event.FocusListener() {
				public void focusGained(java.awt.event.FocusEvent e) {
					jTextField.setText("");
				}
				public void focusLost(java.awt.event.FocusEvent e) {
					try
					{
						int temp = Integer.parseInt(jTextField.getText());
						myKM.setkey_t(temp);
					}
						
					catch (NumberFormatException nfe) {}
						
				}
			});
		}
		return jTextField;
	}

	/**
	 * This method initializes jTextField1	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField1() {
		if (jTextField1 == null) {
			jTextField1 = new JTextField("key s...",10);
			jTextField1.setToolTipText("Enter key s here");
			IntVerifier iv = new IntVerifier();
			jTextField1.setInputVerifier(iv);
			jTextField1.addFocusListener(new java.awt.event.FocusListener() {
				public void focusGained(java.awt.event.FocusEvent e) {
					jTextField1.setText("");
				}
				public void focusLost(java.awt.event.FocusEvent e) {
					try {
						myKM.setkey_s(Integer.parseInt(jTextField1.getText()));
					}
					catch (NumberFormatException nfe) {}
				}
			});
		}
		return jTextField1;
	}

	/**
	 * This method initializes jTextField2	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField2() {
		if (jTextField2 == null) {
			jTextField2 = new JTextField("modulus m:",10);
			jTextField2.setToolTipText("Enter Modulus m here");
			IntVerifier iv = new IntVerifier();
			jTextField2.setInputVerifier(iv);
			jTextField2.addFocusListener(new java.awt.event.FocusListener() {
				public void focusGained(java.awt.event.FocusEvent e) {
					jTextField2.setText("");
				}
				public void focusLost(java.awt.event.FocusEvent e) {
					try
					{
						int temp = Integer.parseInt(jTextField2.getText());
						myKM.setmod(temp);
					}
						
					catch (NumberFormatException nfe) {}
						
				}
			});
		}
		return jTextField2;
	}

	/**
	 * This method initializes jTextField3	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField3() {
		if (jTextField3 == null) {
			jTextField3 = new JTextField("p1...",10);
		}
		return jTextField3;
	}

	/**
	 * This method initializes jTextField4	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField4() {
		if (jTextField4 == null) {
			jTextField4 = new JTextField("p2...",10);
		}
		return jTextField4;
	}

	/**
	 * This method initializes jTextField5	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField5() {
		if (jTextField5 == null) {
			jTextField5 = new JTextField("c1...",10);
		}
		return jTextField5;
	}

	/**
	 * This method initializes jTextField6	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getJTextField6() {
		if (jTextField6 == null) {
			jTextField6 = new JTextField("c2...",10);
		}
		return jTextField6;
	}
	private void exitKT()
	{
		System.exit(0);
	}
	/**
	 * This method initializes jButton7	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton7() {
		if (jButton7 == null) {
			jButton7 = new JButton();
			jButton7.setText("Generate Modulus");
			jButton7.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					myKM.genMod();
				}
			});
		}
		return jButton7;
	}

	/**
	 * This method initializes jRadioButton	
	 * 	
	 * @return javax.swing.JRadioButton	
	 */
	private JRadioButton getJRadioButton() {
		if (jRadioButton == null) {
			jRadioButton = new JRadioButton();
			jRadioButton.setSelected(true);
			jRadioButton.addItemListener(new java.awt.event.ItemListener() {
				public void itemStateChanged(java.awt.event.ItemEvent e) {
					if (jRadioButton.isSelected())
						myKM.setMethod("TAUSCH");
				}
			});
		}
		return jRadioButton;
	}

	/**
	 * This method initializes jRadioButton1	
	 * 	
	 * @return javax.swing.JRadioButton	
	 */
	private JRadioButton getJRadioButton1() {
		if (jRadioButton1 == null) {
			jRadioButton1 = new JRadioButton();
			jRadioButton1.addItemListener(new java.awt.event.ItemListener() {
				public void itemStateChanged(java.awt.event.ItemEvent e) {
					if (jRadioButton1.isSelected())
						myKM.setMethod("VIGNERE");
				}
			});
		}
		return jRadioButton1;
	}

	/**
	 * This method initializes jPanel4	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel4() {
		if (jPanel4 == null) {
			GridLayout gridLayout = new GridLayout();
			gridLayout.setRows(1);
			gridLayout.setColumns(4);
			jLabel15 = new JLabel();
			jLabel15.setText("");
			jLabel14 = new JLabel();
			jLabel14.setText("Status: ");
			jPanel4 = new JPanel();
			jPanel4.setLayout(gridLayout);
			jPanel4.add(jLabel14, null);
			jPanel4.add(jLabel15, null);
		}
		return jPanel4;
	}

	/**
	 * This method initializes jButton8	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton8() {
		if (jButton8 == null) {
			jButton8 = new JButton();
			jButton8.setText("Calc. Inv.");
			jButton8.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					myKM.calcModInv();
				}
			});
		}
		return jButton8;
	}

	/**
	 * This method initializes jPanel5	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel5() {
		if (jPanel5 == null) {
			GridLayout gridLayout1 = new GridLayout();
			gridLayout1.setRows(0);
			gridLayout1.setColumns(3);
			GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
			gridBagConstraints11.gridy = 3;
			gridBagConstraints11.fill = GridBagConstraints.BOTH;
			gridBagConstraints11.gridx = 1;
			jPanel5 = new JPanel();
			jPanel5.setLayout(gridLayout1);
			jPanel5.add(getJButton4(), null);
			jPanel5.add(getJButton5(), null);
			jPanel5.add(getJButton6(), null);
		}
		return jPanel5;
	}

	/**
	 * This method initializes jButton9	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton9() {
		if (jButton9 == null) {
			jButton9 = new JButton();
			jButton9.setText("Set known pairs");
			jButton9.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					char p1,c1,p2,c2;
					p1=jTextField3.getText().charAt(0);
					c1=jTextField5.getText().charAt(0);
					p2=jTextField4.getText().charAt(0);
					c2=jTextField6.getText().charAt(0);
					myKM.setKnownPlain(p1,c1,p2,c2);
				}
			});
		}
		return jButton9;
	}

	public static void main (String[] argv)
	{
		KryptTool myKT = new KryptTool();
		
		//myKT.initialize();
		myKT.setVisible(true);
	}
}  //  @jve:decl-index=0:visual-constraint="10,10"