I have one JFrame(HMSDoctor)
and in that i am calling one JInternalFrame(CurrentOPD)
by using JDesktopPane
.
//opening JInternalFrame(CurrentOPD) by using JDesktopPane in JFrame(HMSDoctor).
JDesktopPane jdp=new JDesktopPane();
jdp.add(new CurrentOPD);
//Above code display proper JInternalFrame.
When i close that JInternalFrame at that time i want to execute one other JInternalFrame(Follow) in JFrame(HMSDoctor)
.
How can i do like that?
See the section from the Swing tutorial on How to Write an Internal Frame Listener . I would guess you would want to listen for the "closed" event and then do some additional processing.
public void actionPerformed(ActionEvent e) {
if (SHOW.equals(e.getActionCommand())) {
...
if (listenedToWindow == null) {
listenedToWindow = new JInternalFrame("Event Generator",
true, //resizable
true, //closable
true, //maximizable
true); //iconifiable
//We want to reuse the internal frame, so we need to
//make it hide (instead of being disposed of, which is
//the default) when the user closes it.
listenedToWindow.setDefaultCloseOperation(
WindowConstants.HIDE_ON_CLOSE);
listenedToWindow.addInternalFrameListener(this);
...
}
}
...
}
是的,首先你必须在主frame
添加addInternalFramaeListener
,当你的JInternalFrame(CurrentOPD)
关闭时,你可以调用JInternalFrame(Follow)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.