日期:2014-05-20 浏览次数:20689 次
import javax.swing.*;
public class Test {
private JFrame windows;
private JPanel P,p1,p2,p3;
private JTabbedPane T;
public Test(){
MakeFrame();
}
private void MakeFrame()
{
windows = new JFrame("测试界面");
// windows.setLayout(null);
windows.setBounds(50,50,1200,700);
windows.setResizable(false);//设置主窗体为固定大小
P = new JPanel();
P.setBounds(0,0,900,600);
T = new JTabbedPane();
T.setBounds(0,0,800,500);
p1 = new JPanel();
p1.setSize(800,450);
p2 = new JPanel();
p2.setSize(800,450);
p3 = new JPanel();
p3.setSize(800,450);
T.addTab("标签页1", null, p1, "1");
T.addTab("标签页2", null, p2, "2");
T.addTab("标签页3", null, p3, "3");
P.add(T);
windows.add(P);
windows.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//设置右上角关闭
windows.pack();
windows.setVisible(true);
}
public static void main(String[] args)
{
new Test();
}
}
windows.setLayout(null);