internal frame listener...

hi, can anyone tell me if i can add an action listener to the title bar of an internal frame?and if yes, how do i implement it..thanx in advance
[172 byte] By [PumpkinPiea] at [2007-9-27 8:49:02]
# 1

as in something like this? jsut make sure your class extends JInternalFrame and implements InternalFrameListener!

public void internalFrameOpened(InternalFrameEvent e){}

public void internalFrameClosed(InternalFrameEvent e){}

public void internalFrameActivated(InternalFrameEvent e){}

public void internalFrameDeactivated(InternalFrameEvent e){}

public void internalFrameClosing(InternalFrameEvent e){}//windowClosing

public void internalFrameIconified(InternalFrameEvent e){}

public void internalFrameDeiconified(InternalFrameEvent e){ }

MikeOCa at 2007-7-8 17:24:05 > top of Java-index,Archived Forums,Swing...
# 2
mike, if iam not mistaken, this code in the main file that calls the internalframe, the main file implements an InternalFrameListener and should have all that code.asrar
wild_wolfa at 2007-7-8 17:24:05 > top of Java-index,Archived Forums,Swing...
# 3

Hi!

To those of interest... I've got something running regarding this issue.

I did NOT succeed by having the MyInternalFrame implementing the InternalFrameListener.

And I did NOT succeed by having the main file implementing the InternalFrameListener either.

But in the main file I added an anonymous listener-class to the attribute which holds the reference to MyInternalFrame, and that works :-)

public class MainFrame extends JFrame {

...

private MyInternalFrame createNewInternalFrame() {

MyInternalFrame mif = new MyInternalFrame();

mif.addInternalFrameListener(new InternalFrameListener() {

public void internalFrameOpened(InternalFrameEvent e) {}

public void internalFrameClosed(InternalFrameEvent e) {}

public void internalFrameActivated(InternalFrameEvent e) {}

public void internalFrameDeactivated(InternalFrameEvent e) {}

public void internalFrameClosing(InternalFrameEvent e) {}

public void internalFrameIconified(InternalFrameEvent e) {}

public void internalFrameDeiconified(InternalFrameEvent e) {}

}

return mif;

}

...

}

cheers,

michel

mibe2204a at 2007-7-8 17:24:05 > top of Java-index,Archived Forums,Swing...