?? example5_2.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 + -