Your code layout was a train wreck. Please write neat and legible code with matching indentation. I advise you to use English names for classes, variables and methods. Otherwise it will be confusing when you read them alongside JDK or library names which are nearly always in English.
To show a text dialog you can use the following code:
public class TextDialog extends Dialog implements ActionListener {
private static final long serialVersionUID = 1L;
private boolean dialogCompleted = false;
private Button ok, can;
private TextField input;
public TextDialog() {
super(new Frame(""), "Text dialog", true);
setLayout(new FlowLayout());
input = new TextField(15);
add(new Label("Input :"));
add(input);
addOKCancelPanel();
createFrame();
pack();
setVisible(true);
}
private void addOKCancelPanel() {
Panel p = new Panel();
p.setLayout(new FlowLayout());
createButtons(p);
add(p);
}
private void createButtons(Panel p) {
p.add(ok = new Button("OK"));
ok.addActionListener(this);
p.add(can = new Button("Cancel"));
can.addActionListener(this);
}
private void createFrame() {
Dimension d = getToolkit().getScreenSize();
setLocation(d.width / 4, d.height / 3);
}
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == ok) {
dialogCompleted = true;
setVisible(false);
} else if (ae.getSource() == can) {
dialogCompleted = false;
setVisible(false);
}
}
public boolean isDialogCompleted() {
return dialogCompleted;
}
public String getInput() {
return input.getText();
}
}
To set up an arbitrary number of dice you need a datastructure that can hold any number of dice. Take a look at java.util.List
For example:
private List<Dobbelsteen> dice;
public TekenPaneel() {
TextDialog dialog = new TextDialog();
int numberOfDice;
if (dialog.isDialogCompleted()) {
numberOfDice = Integer.parseInt(dialog.getInput());
}
else {
// use a default if the user cancels the input
numberOfDice = 2;
}
dice = new ArrayList<Dobbelsteen>();
int x = 1;
for(int i = 1; i < numberOfDice; i++) {
dice.add(new Dobbelsteen(x));
x = x + 2;
}