我有一个JFrame(HMSDoctor),因为我使用JDesktopPane调用一个JInternalFrame(CurrentOPD)。
//opening JInternalFrame(CurrentOPD) by using JDesktopPane in JFrame(HMSDoctor).
JDesktopPane jdp=new JDesktopPane();
jdp.add(new CurrentOPD);
//Above code display proper JInternalFrame.当我关闭那个JInternalFrame时,我想在JFrame(HMSDoctor)中执行另一个JInternalFrame(跟随)。
我怎么能这样做?
发布于 2013-11-22 17:28:07
是的,首先您必须在main frame中使用frame,当JInternalFrame(CurrentOPD)关闭时,您可以调用JInternalFrame(Follow)
发布于 2013-11-20 06:21:34
请参阅关于如何编写内部帧侦听器的Swing教程中的部分。我想您会想要侦听“关闭”事件,然后再做一些额外的处理。
发布于 2013-11-20 06:34:29
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);
...
}
}
...
}https://stackoverflow.com/questions/20088836
复制相似问题