📄 right7_2_3_8.htm
字号:
<html><head><title>JAVA编程语言</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><link rel="stylesheet" href="../../../css/text.css" type="text/css"></head><body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" ><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td valign="top"> <table width="97%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF"> <tr> <td height="244" valign="top"> <p> <span class="pt9-black"> <img src="../../../images/tu/ch07/7_2_3_8.gif" width="363" height="151"> <br> <br> 内部框架JInternalFrame就如同一个窗口在另一个窗口内部,其特点如下:<br> 1) 必须把内部框架添加到一个容器中(通常为JDesktopPane),否则不显示;<br> 2) 不必调用show()或setVisible()方法,内部框架随所在的容器一起显示;<br> 3) 必须用setSize()或pack()或setBounds方法设置框架尺寸,否则尺寸为零,框架不能显示;<br> 4) 可以用setLocation()或setBounds( ) 方法设置内部框架在容器中的位置,缺省值为0,0,即容器的左上角;<br> 5) 象顶层JFrame一样,对内部框架添加组件也要加在它的内容面板上;<br> 6) 在内部框架中建立对话框,不能使用JDialog作为顶层窗口,必须用JOptionPane或JInternalFrame;<br> 7) 内部框架不能监听窗口事件,可以通过监听与窗口事件类似的内部框架(JInternalFrameEvent)处理内部框架窗口的操作。<br> <br> JFrame frame=new JFrame("InternalFrameDemo"); <font color="339900">//实例化窗口</font><br> JDesktopPane desktop=new JDesktopPane(); <font color="339900">//实例化容器JDesktopPane</font><br> MyInternalFrame myframe=new MyInternalFrame(); <font color="339900">//实例化内部窗口</font><br> desktop.add(myframe); <font color="339900">//把内部窗口添加到容器中</font><br> myframe.setSelected(true); <font color="339900">//内部面板是可选择的</font><br> frame.setContentPane(desktop);<font color="339900"> //把desktop设为frame的内容面板</font></span></p> </td> </tr> </table> </td> </tr></table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -