event doesn't switch context after switching jpane & class

Hi,

I have (almost) managed the concept (tight) coupling. I switch panels on the display by invoking a method in the parent. However something strange occurs:

I have a first panel with an actionListener, getting a user name.

I have a second panel showing a simple list of choices 1 .. 2.. 3 .. also with an actionListener.

When I switch the panels from the usernamepanel to the choicespanel I see the choicespanel,

but making a choice and pressing <enter> tells me to put in a userID (I cleaned that field on the first panel).

So the actionListener defined with the choicespanel is not 'in control'.

And the actionListener with the username still is.

Explicitly removing the actionListener from the first panel does not help (?!)

Would you know what it is that I do not understand about this situation?

publicvoid checkUsername (){

JPanel sign_in_pnl =new Sign_in(this);

this.add(sign_in_pnl,"0,0,0,0");

Sign_in.User.requestFocus();

}

publicvoid switchComponent (){

this.remove(1);

JPanel choose00 =new Choose00();

this.add(choose,"0,0,0,0");

Choose00.Selection.requestFocus();

}

[1608 byte] By [WimEa] at [2007-11-26 16:47:41]
# 1

You might get an answer, but I think you may have missed the message at the top of this forum:

Thank you for any participation in this forum. Due to a lack of relevant activity, we have decided to archive this forum on June 16, 2006. For future posts on this topic, we suggest you use the Enterprise JavaBeans forum.

Thank you for using Sun Forums.

zadoka at 2007-7-8 23:15:11 > top of Java-index,Security,Event Handling...