package introducereIntrebari;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class DialogIntroducereIntrebare extends Dialog implements ActionListener{
Button ok;
TextField ta1;
TextField tf1,tf2,tf3,tf4,tf5,tf6;
String itr;
String r1;
String r2;
String r3;
String r4;
String r5;
String r6;
public DialogIntroducereIntrebare(Frame parinte, String titlu, boolean modala) {
super( parinte, titlu, modala);
this.addWindowListener(new WindowAdapter ()
{
public void windowClosing(WindowEvent e)
{
dispose();
}
});
setLayout (new GridLayout(6,1));
Panel intrebare = new Panel();
Label lab1 = new Label ("Intrebarea:",Label.LEFT);
lab1.setBackground(Color.lightGray);
TextField ta1 = new TextField("",30);
intrebare.add(lab1, BorderLayout.NORTH);
intrebare.add(ta1, BorderLayout.SOUTH);
Panel raspuns1 = new Panel ();
Label lab2 = new Label ("a) ", Label.LEFT);
lab2.setBackground(Color.lightGray);
TextField tf1 = new TextField("", 20);
raspuns1.add(lab2, BorderLayout.EAST);
raspuns1.add(tf1, BorderLayout.WEST);
Panel raspuns2 = new Panel ();
Label lab3 = new Label ("b) ", Label.LEFT);
lab3.setBackground(Color.lightGray);
TextField tf2 = new TextField("", 20);
raspuns2.add(lab3, BorderLayout.EAST);
raspuns2.add(tf2, BorderLayout.WEST);
Panel raspuns3 = new Panel ();
Label lab4 = new Label ("c) ", Label.LEFT);
lab4.setBackground(Color.lightGray);
TextField tf3 = new TextField("", 20);
raspuns3.add(lab4, BorderLayout.EAST);
raspuns3.add(tf3, BorderLayout.WEST);
Panel raspuns4 = new Panel ();
Label lab5 = new Label ("d) ", Label.LEFT);
lab5.setBackground(Color.lightGray);
TextField tf4 = new TextField("", 20);
raspuns4.add(lab5, BorderLayout.EAST);
raspuns4.add(tf4, BorderLayout.WEST);
Panel raspuns5 = new Panel ();
Label lab6 = new Label ("e) ", Label.LEFT);
lab6.setBackground(Color.lightGray);
TextField tf5 = new TextField("", 20);
raspuns5.add(lab6, BorderLayout.EAST);
raspuns5.add(tf5, BorderLayout.WEST);
Panel raspuns6 = new Panel ();
Label lab7 = new Label ("Raspunsul Corect ", Label.LEFT);
lab7.setBackground(Color.lightGray);
TextField tf6 = new TextField("", 20);
tf6.setBackground(Color.RED);
ok = new Button("OK");
raspuns6.add(lab7, BorderLayout.EAST);
raspuns6.add(tf6, BorderLayout.WEST);
raspuns6.add(ok, BorderLayout.SOUTH);
add(intrebare);
add(raspuns1);
add(raspuns2);
add(raspuns3);
add(raspuns4);
add(raspuns5);
add(raspuns6);
ta1.addActionListener(this);
tf1.addActionListener(this);
tf2.addActionListener(this);
tf3.addActionListener(this);
tf4.addActionListener(this);
tf5.addActionListener(this);
tf6.addActionListener(this);
ok.addActionListener(this);
setBackground(Color.lightGray);
setSize (600,800);
show();
}
public void actionPerformed(ActionEvent e)
{
if (e.getActionCommand()=="OK" )
{
try
{
System.out.println(ta1.getText());
System.out.println(tf1.getText());
System.out.println(tf2.getText());
System.out.println(tf3.getText());
System.out.println(tf4.getText());
System.out.println(tf5.getText());
System.out.println(tf6.getText());
}
catch (Exception e1)
{
System.out.println(e1);
}
dispose();
}
}
}