⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example5_2.java

📁 书中的例题
💻 JAVA
字号:
 /* 建立JFrame子类的内部窗体 */
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
 class Rootwindow extends JFrame implements ActionListener
 {
   Container con;
   Rootwindow()
   { 
	 setSize(200,200);
	 setVisible(true);
     con=getContentPane(); 
	 con.setLayout(new FlowLayout());
     JButton jbtn=new JButton("打开一个内部窗体");
	 con.add(jbtn);
	 jbtn.addActionListener(this);
	 validate();
     addWindowListener(new WindowAdapter()
         {public void windowClosing(WindowEvent e)
            {System.exit(0);}
         });
   }
  public void actionPerformed(ActionEvent e)
	{ JInternalFrame intf;
	  intf=new JInternalFrame("内部窗体",true,true,true,true);
      intf.setSize(60,60);
	  intf.setVisible(true);
	  con.add(intf);
	  JTextArea text=new JTextArea(5,15);
      intf.getContentPane().add(text,BorderLayout.CENTER);
   }
}
public class Example5_2
{  public static void main(String args[])
   { Rootwindow win=new Rootwindow();   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -