中间容器 - JTabbedPane的用法的最简举例

摘自并整理http://blog.csdn.net/liu_zhen_wei/article/details/6445345

JTabbedPane的用法的最简举例

中间容器 - JTabbedPane的用法的最简举例

 package com.wst.bj;

 import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane; public class JTabbedPaneDemo {
public static void main(String[] args) {
UIManager ui = new UIManager();
ui.initUI();
}
} class UIManager extends JFrame { public UIManager() {
super("学生信息管理系统");
} public void initUI() {
this.setBounds(300, 300, 500, 400);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
System.exit(0);
}
});
layoutUI();
this.setVisible(true);
} private void layoutUI() { // 对象实例化
JTabbedPane tab = new JTabbedPane(JTabbedPane.TOP);
// 容器
Container container = this.getLayeredPane();
// 对象化面板
JPanel combop = new JPanel();
JPanel p1 = new JPanel();
JPanel p2 = new JPanel();
JPanel p3 = new JPanel();
JPanel p4 = new JPanel(); tab.add(p1, "Select");
tab.add(p2, "Updata");
tab.add(p3, "Inserte");
tab.add(p4, "Delete"); combop.add(new JLabel("学生信息管理系统")); container.setLayout(new BorderLayout());
container.add(combop, BorderLayout.NORTH);
container.add(tab, BorderLayout.CENTER); }
}
上一篇:笔记 jsp/ajax/js/jquery/html5/css+div->table


下一篇:测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程