package ip.hak;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class QuestionDialog extends ClosableDialog implements ActionListener {
Label cLabel; Label rLabel; TextField cTextField;
TextField rTextField;
Button oKButton;
int colum = 3;
int row = 3;
public QuestionDialog(Frame parent, String title) {
super(parent, title, true);
}
public void makeDialog() {
init();
setVisible(true);
}
private void init() {
setLayout(null);
Insets in = getInsets();
setSize(in.left + in.right + 154, in.top + in.bottom + 132);
cLabel = new Label("Colums : ");
cLabel.setBounds(in.left + 30, in.top + 30, 60, 12);
add(cLabel);
cTextField = new TextField("3");
cTextField.setBounds(in.left + 100, in.top + 30, 30, 20);
add(cTextField);
rLabel = new Label("Rows : ");
rLabel.setBounds(in.left + 40, in.top + 60, 40, 12);
add(rLabel);
rTextField = new TextField("3");
rTextField.setBounds(in.left + 100, in.top + 60, 30, 20);
add(rTextField);
oKButton = new Button("OK");
oKButton.setBounds(in.left + 30, in.top + 100, 88, 20);
oKButton.addActionListener(this);
add(oKButton);
}
public int getColum() {
return colum;
}
public int getRow() {
return row;
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == oKButton) {
String temp = cTextField.getText();
try {
Integer itemp = null;
itemp = itemp.valueOf(temp);
colum = itemp.intValue();
} catch (NumberFormatException nfe) {
System.out.println("Input Number!!!");
}
temp = rTextField.getText();
try {
Integer itemp = null;
itemp = itemp.valueOf(temp);
row = itemp.intValue();
} catch (NumberFormatException nfe) {
System.out.println("Input Number!!!");
}
setVisible(false);
return;
}
}
}