开发者

lwuit container

开发者 https://www.devze.com 2022-12-19 14:48 出处:网络
I have added a container named btnBar with boxlayout(x-axis) on a form. the container has 4 buttons of custom class MyButton that extends from Button开发者_运维技巧 itself. When i add actionlistener t

I have added a container named btnBar with boxlayout(x-axis) on a form. the container has 4 buttons of custom class MyButton that extends from Button开发者_运维技巧 itself. When i add actionlistener to one of the buttons in the container it gets invoked for each n every button. Even the actionevent.getsource.gettext method returns the same value irrespective of the focus. I have added the buttons through an array and m trying to use is something like this:

btns[0].addActionListener(......)

Where am I going wrong?


got is solved buddies...actually was using setfocus() to traverse within the btnBar on buttons...but needed to use setFocused() method of form too....after setFocus()....dnt hammer ur brains now....


You must never use setFocus, you should use setFocusable to toggle focusability and requestFocus to get the focus to a specific component.

You should also migrate to Codename One, since LWUIT is pretty much unmaintained.

0

精彩评论

暂无评论...
验证码 换一张
取 消