Question: How to get active (having focus) frame (JInternalFrame) that is inside JDesktopPane? I need it for my MDI notepad (not that anybody would use that, just a training project). Looking at api, I see only functions to get all JInternalFrames, not active one.

Answer: 
Use [JDekstopPane.getSelectedFrame()](http://docs.oracle.com/javase/7/docs/api/javax/swing/JDesktopPane.html) method (*From doc: currently active JInternalFrame in this JDesktopPane, or null if no JInternalFrame is currently active.*) or `JDesktopPane.getAllFrames()` to get list of all `JInternalFrames` currently displayed in the desktop and check `isSelected()` method.
Make a `List<JInternalFrame>` and check [`isSelected()`](http://docs.oracle.com/javase/7/docs/api/javax/swing/JInternalFrame.html#isSelected%28%29) as you iterate though it.

Addendum: See also this [example](http://groups.google.com/group/comp.lang.java.programmer/msg/2e1b14bcad9bd7fa) that uses `Action` to select an internal frame from a menu.