i have several JPanels which each implement their logic, buttons and fields on their own. This panels are all added on a JFrame but sometimes on another Panel which is then added on the frame...

What i want to achive is that hte default button is the ok button for panel1 when any successor of it has the focus. And same for all the others...

How to do this? The panels itself dont have a JRootPane and I don't want to bother the Frame with the logic for that.

Every tip is welcome ;). Thanks in advance.

有帮助吗?

解决方案

i have several JPanels which each implement their logic, buttons and fields on their own. This panels are all added on a JFrame but sometimes on another Panel which is then added on the frame...

What i want to achive is that hte default button is the ok button for panel1 when any successor of it has the focus. And same for all the others...

The panels itself dont have a JRootPane and I don't want to bother the Frame with the logic for that.

  • I think you are right, to use CardLayout
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top