Dialog d = new Dialog( getParentWindow(comp),title); // comp为applet上的任意一个组件 .... public void getParentWindow(Component compOnApplet,String title){ Container c = compOnApplet.getParent(); while (c != null) { if (c instanceof Frame) return (Frame) c; c = c.getParent(); } return null; }
用JDialog可以使用模态窗口实现