Skip to main content

Event doesn't thrown in a Dialog

5 replies [Last post]
mkant
Offline
Joined: 2010-02-03

Hello,

I put this in a new thread:

In a early build this works:
I have a frame.
In this frame is a panel.
And in this panel is a textfield.
When I focus this textfield a new Dialog open with the numbers of 1-9.
And if I clicked any button, this number should sow in the textfield.

But now I can not clicked the number buttons in the Dialog. So now click-Event is thrown.

I hope anybody can help me or it will be fixed.

Thanks.

Best regards,

Mathias

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mkant
Offline
Joined: 2010-02-03

I have wrote the code you want.

Is there any developement in this problem?

Thank you.

Mathias

davyp
Offline
Joined: 2007-01-03

With all due respect, but the code mentioned above does not help me much. I had a look at it, and
it obviously does not compile because it has pseudo-code, references to non-standard J2ME
classes, typos, and missing methods. You also declare a DialogTest as a subclass of Panel but it
is not used anywhere. Could you provide a working example with all the irrelevant code stripped
out?

Thanks
Davy

mkant
Offline
Joined: 2010-02-03

this was a very simple example
I hope you will understand the nearly pseudo code.

davyp
Offline
Joined: 2007-01-03

Could you post a small code example that triggers this issue for you? I just want to avoid
spending time making my own a test example that may not show this problem because I did a
few things differently.

Thanks
Davy

mkant
Offline
Joined: 2010-02-03

public class textField extends Frame {

public static void main (String []args) {
textField m = new textField();
}

public textField() {
Panel p = new Panel();
FormattedTextField ftf = new FormattedTextField();
p.add(ftf);
this.add(p);
this.setSize(500,500);
this.setVisible(true);

}

if the textfield focused: showKeyboard(this);
}

class DialogTest extends Panel{

DialogTest(){
Button newButton = new Button("1");
new Button.addActionListener(new ButtonListener(1));
this.add(newButton);

...
}

showKeyboard(_parent){
this.dialog = new Dialog(_parent);
this.dialog.setLayout(new GridLayout());
this.dialog.add(this);
this.dialog.setSize(80,100);
this.dialog.setUndecorated(true);
this.dialog.setVisible(_show);
_location.setLocation(_location.x, (_location.y + 20));
this.dialog.setLocation(_location);
}
}
protected class ButtonListener implements ActionListener {

/* ID of the button */
private int buttonId;

ButtonListener(int _buttonId) {
this.buttonId = _buttonId;
}

public void actionPerformed(ActionEvent _e) {
fireButtonClicked(this.buttonId);
}
}

Message was edited by: mkant