![Quote](https://www.javaprogrammingforums.com/images/misc/quote_icon.png)
Originally Posted by
bugemberuth
It something to do with Cardlayout
"focus" has, directly and by itself, nothing to do with a layout manager.
![Quote](https://www.javaprogrammingforums.com/images/misc/quote_icon.png)
Originally Posted by
bugemberuth
below is the magic code;
myPanelThatHoldsTheGraphicsInCardLayoutClass.getComponent(indexOfTheGraphicsInstance).requestFocus();
//i.e mainPanel.getComponent(0).requestFocus();
Sorry ... there's no "magic" ..... just only the same "twisted" code!
12 days ago (my answer #5) I told you to use:
anyClass.requestFocusInWindow();
And eventually, it's also possible to put the requestFocusInWindow into the AnyClass constructor:
AnyClass() {
..........
requestFocusInWindow();
}
So ... what is (was) the difficulty about this?