Retrieve Selected Internal Frame?

Hi all!

I have a problem.....

i've got a desktop for an MDI app defined as:

JDesktopPane desktop

Now, I need a static method to get the selected internal frame so it's accessable from elsewhere.

I tried:

publicstatic MyIFrame getMySelectedFrame()

{

return (MyIFrame)desktop.getSelectedFrame();

}

but it tells me I can't access desktop in a static method. What am I missing to manage this?

Thanks!

Tom

[638 byte] By [TCArknighta] at [2007-10-2 6:04:38]
# 1
Is "desktop" a static variable or a class variable?
camickra at 2007-7-16 13:05:07 > top of Java-index,Java Essentials,Java Programming...
# 2

class variable....

not defined as static.

public class myGUI extends JFrame {

JDesktopPane myDesktop;

...

//constructor

public myGUI(){

}

public static getDesktop(){

return desktop;

}

public static getSelectedIFrame(){

return desktop.selectedFrame();

}

I have another class that needs to access the active Internal Frame, but at the moment, all I can think of is to pass the current myGUI to every internal frame...

Tom

TCArknighta at 2007-7-16 13:05:07 > top of Java-index,Java Essentials,Java Programming...