package first;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class TtpDemo extends JFrame
{
TtpDemo() {
// TODO Auto-generated constructor stub
super("卡片选项页面示例");
setSize(300,200);
setVisible(true);
JTabbedPane jtp=new JTabbedPane();///定义卡片选项面页
///定义三张图片
ImageIcon icon1=new ImageIcon("./image/1.jpg");
ImageIcon icon2=new ImageIcon("./image/2.jpg");
ImageIcon icon3=new ImageIcon("./image/4.jpg");
jtp.addTab("城市", icon1,new CitiesPanel(),"城市名称");
jtp.addTab("文学", icon2,new BookPanel(),"文学书目");
jtp.addTab("网站", icon3,new NetPanel(),"精选网址");
getContentPane().add(jtp);
validate();
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}
///定义面板CitiesPanel
class CitiesPanel extends JPanel
{
public CitiesPanel() {
// TODO Auto-generated constructor stub
JButton b1 =new JButton("北京");
JButton b2=new JButton("上海");
JButton b3 =new JButton("深圳");
JButton b4=new JButton("厦门");
add(b1);
add(b2);
add(b3);
add(b4);
}
}
///定义面板BookPanel
class BookPanel extends JPanel
{
public BookPanel() {
// TODO Auto-generated constructor stub
JCheckBox cb1=new JCheckBox("西游记");
JCheckBox cb2=new JCheckBox("三国演义");
JCheckBox cb3=new JCheckBox("红楼梦");
add(cb1);
add(cb2);
add(cb3);
}
}
///定义面板NetPanel
class NetPanel extends JPanel
{
public NetPanel() {
// TODO Auto-generated constructor stub
JComboBox jcb=new JComboBox();
jcb.addItem("思维论坛");
jcb.addItem("百度搜索");
jcb.addItem("java爱好者");
add(jcb);
}
}
public class Test
{
public static void main(String[] args)
{
new TtpDemo();
}
}

最新文章

  1. [原创]MySQL RR隔离级别下begin或start transaction开启事务后的可重复读?
  2. js 表单验证方法二
  3. mac--又发现了一款mac快捷键神器
  4. 【转】VS2010中 C++创建DLL图解
  5. 【ACMER纷纷表示】女生应该找一个玩ACM的男生
  6. jquery通过ajax获取数据(优化、封装)
  7. lightoj 1007
  8. kvm安装及配置
  9. python 文件及文件夹操作
  10. Android-67-Tomcat启动出错:Server Tomcat v7.0 Server at localhost failed to start.
  11. Angular - 预加载 Angular 模块
  12. bat脚本+diskpart 脚本实现自动划分磁盘分区
  13. shiro缓存管理
  14. Codeforces 1009G Allowed Letters 最大流转最小割 sosdp
  15. font-family 中文字体列表
  16. MySQL的SQL语句
  17. Ubuntu 16.04下安装golang
  18. select * from v$reserved_words
  19. linux平台模拟生成CAN设备
  20. selenium page object模式

热门文章

  1. Excel拼接字符串
  2. 在Android上,怎样与Kotlin一起使用Retrofit(KAD21)
  3. zabbix 2.2 调小监控值
  4. Floatingip
  5. asm和file system之间数据文件的转换
  6. 分词(Tokenization) - NLP学习(1)
  7. nodeJs 调试异步程序追踪异步报错
  8. 爬虫:Scrapy17 - Common Practices
  9. IDEA运行lambda表达式
  10. 【iOS开发】字典的快速赋值 setValuesForKeysWithDictionary