The Enigma Machine Deans Amazing Enigma Coding Machine Encod
Solution
you have to change respective names in the code
import javax.swing.*;
import java.awt.Color;
import java.awt.event.*;
class EngineMachine extends JFrame implements ActionListener{
JRadioButton rb1,rb2,ci1,ci2,ci3,ci4,ci5,co1,co2,co3,co4,co5,cm1,cm2,cm3,cm4,cm5;
JButton b,b2;
JLabel jl1,jl2,jl3,jl4,jl5,jl6,jl7;
EngineMachine(){
rb1=new JRadioButton(\"Encoder\");
rb1.setBounds(100,50,100,30);
rb2=new JRadioButton(\"Decoder\");
rb2.setBounds(100,100,100,30);
ButtonGroup bg=new ButtonGroup();
bg.add(rb1);bg.add(rb2);
jl1=JLabel(\"text1\");
jl1.setBounds(100,0,100,30);
jl2=JLabel(\"text2\");
jl2.setBounds(200,0,100,30);
jl3=JLabel(\"text3\");
jl3.setBounds(300,0,100,30);
jl4=JLabel(\"text4\");
jl4.setBounds(400,0,100,30);
ci1=new JRadioButton(\"Decider\");
ci1.setBounds(200,50,100,30);
ci2=new JRadioButton(\"Decider\");
ci2.setBounds(200,100,100,30);
ci3=new JRadioButton(\"Decider\");
ci3.setBounds(200,150,100,30);
ci4=new JRadioButton(\"Decider\");
ci4.setBounds(200,200,100,30);
ci5=new JRadioButton(\"Decider\");
ci5.setBounds(200,250,100,30);
cm1=new JRadioButton(\"Decoder\");
cm1.setBounds(300,50,100,30);
cm2=new JRadioButton(\"Decoder\");
cm2.setBounds(300,100,100,30);
cm3=new JRadioButton(\"Decoder\");
cm3.setBounds(300,150,100,30);
cm4=new JRadioButton(\"Decoder\");
cm4.setBounds(300,200,100,30);
cm5=new JRadioButton(\"Decoder\");
cm5.setBounds(300,250,100,30);
co1=new JRadioButton(\"Decoder\");
co1.setBounds(400,50,100,30);
co2=new JRadioButton(\"Decoder\");
co2.setBounds(400,100,100,30);
co3=new JRadioButton(\"Decoder\");
co3.setBounds(400,150,100,30);
co4=new JRadioButton(\"Decoder\");
co4.setBounds(400,200,100,30);
co5=new JRadioButton(\"Decoder\");
co5.setBounds(400,250,100,30);
String country[]={\"1\",\"2\",};
JComboBox cb=new JComboBox(country);
cb.setBounds(200,350,100,20);
add(cb);
jl5=JLabel(\"text5\");
jl5.setBounds(200,300,100,30);
JComboBox cb2=new JComboBox(country);
cb2.setBounds(300,350,100,20);
add(cb2);
jl6=JLabel(\"tex6\");
jl6.setBounds(300,300,100,30);
JComboBox cb3=new JComboBox(country);
cb3.setBounds(400,350,100,20);
add(cb3);
jl7=JLabel(\"text7\");
jl7.setBounds(400,300,100,30);
JTextArea area=new JTextArea(500,50);
area.setBounds(500,50,100,50);
area.setBackground(Color.black);
area.setForeground(Color.white);
add(area);
b=new JButton(\"start coding\");
b.setBounds(100,450,150,30);
b.addActionListener(this);
b2=new JButton(\"Exit\");
b2.setBounds(300,450,80,30);
b2.addActionListener(this);
ButtonGroup bg2=new ButtonGroup();
bg2.add(ci1);bg2.add(ci2);
add(rb1);add(rb2);add(b);add(b2); add(co1);add(co2);add(co3);add(co4);add(co5);add(ci1);add(ci2);add(ci3);add(ci4);add(ci5);add(cm1);add(cm2);add(cm3);add(cm4);add(cm5);
setSize(300,300);
setLayout(null);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
if(rb1.isSelected()){
JOptionPane.showMessageDialog(this,\"You are male\");
}
if(rb2.isSelected()){
JOptionPane.showMessageDialog(this,\"You are female\");
}
}
public static void main(String args[]){
new EngineMachine();
}}


