This example retrieves all the tabs in a tabbed pane:

    // To create a tabbed pane, see e828 创建JTabbedPane

    // Get number of tabs
int count = pane.getTabCount(); // Get the properties of each tab
for (int i=0; i<count; i++) {
// Get label
String label = pane.getTitleAt(i); // Get icon
Icon icon = pane.getIconAt(i); // Get tool tip
String tooltip = pane.getToolTipTextAt(i); // Is enabled?
boolean enabled = pane.isEnabledAt(i); // Get mnemonic
int keycode = pane.getMnemonicAt(i); // Get component associated with tab
Component comp = pane.getComponentAt(i);
}

Most of the methods that allow the properties of a tab to be changed require the index of the tab. The index of a tab can change as tabs are added, removed, or moved. Here are three ways to retrieve the index of a tab when needed.

    // Get the index of the first tab that matches a label
String label = "Tab Label";
int index = pane.indexOfTab(label); // Get the index of the first tab that matches an icon; the supplied
// icon must be the same instance that was used to create the tab
index = pane.indexOfTab(icon); // Get the index of the tab by matching the child component; the supplied
// component must be the same instance that was used to create the tab
index = pane.indexOfComponent(component); if (index < 0) {
// The tab could not be found
}
Related Examples

e833. 获得JTabbedPane中的卡片的更多相关文章

  1. e839. 使JTabbedPane中的卡片可滚动

    By default, all the tabs in a tabbed pane are displayed. When the tabs are wider than the width of t ...

  2. e840. 监听JTabbedPane中选中卡片的改变

    A tabbed pane fires a change event whenever the selected tab is changed either by the user or progra ...

  3. e838. 使JTabbedPane中的卡片能用按键的方式选取

    Setting a mnemonic on a tab allows the tab to be selected with a keystroke. For example, if the mnem ...

  4. e832. 从JTabbedPane中移动卡片

    To move a tab, it must first be removed and then reinserted into the tabbed pane as a new tab. Unfor ...

  5. e835. 使JTabbedPane中的卡片生效和失效

    By default, all new tabs are enabled, which means the user can select them. A tab can be disabled to ...

  6. e836. 设置JTabbedPane中卡片的提示语

    There are two ways to set a tool tip on a tab. The first is to specify it when the tab is created; t ...

  7. e837. 设置JTabbedPane中卡片的颜色

    // Create a tabbed pane JTabbedPane pane = new JTabbedPane(); // Set the text color for all tabs pan ...

  8. e834. 设置JTabbedPane中卡片的位置

    The tabs of a tabbed pane can be placed on one of the four edges of its container. By default, when ...

  9. e831. 从JTabbedPane中删除一个卡片

    // To create a tabbed pane, see e828 创建JTabbedPane // Remove the last tab pane.remove(pane.getTabCou ...

随机推荐

  1. kernel dump Analysis

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/0c418482-7edd-4c91-b7f4-6005d550244a/got-the- ...

  2. angular-resource版本差异问题

    在 AngularJS v1.3.0-beta.14 这个版本里,使用query方法,如果传递进来的数据不是数组,会报错. 在 AngularJS v1.2.18 这个版本里,使用query方法,如果 ...

  3. 碰撞器与触发器[Unity]

    请看原帖,移步:Unity3d碰撞检测中碰撞器与触发器的区别 要产生碰撞必须为游戏对象添加刚体(Rigidbody)和碰撞器,刚体可以让物体在物理影响下运动.碰撞体是物理组件的一类,它要与刚体一起添加 ...

  4. 【Android】ADB常用指令与logcat日志

    ADB命令简介 ADB是一个功能强大的命令行工具.通过它可以直接和模拟器或真机进行交互.它是一个具有客户端和服务器端的程序. 它主要由三个部分组成: 客户端,它运行在你的开发机上,你可以通过执行adb ...

  5. Chrome中使用flash引起cpu飙升问题的处理

    本人使用的是Chrome 30 flash 18,在看视频或者登陆有调用flash插件的页面之后,经常会遇到Shockwave Flash插件CPU占用超过50%的情况(在Chrome的任务管理器可以 ...

  6. 二分查找算法(Python版)

    [本文出自天外归云的博客园] 记性不好(@.@),所以平时根本用不到的东西就算学过如果让我去想也会需要很多时间(*.*)! 二分查找算法 在一个有序数组中查找元素最快的算法,也就是折半查找法,先找一个 ...

  7. Node.js学习笔记(2)--提交表单

    说明(2017-5-2 11:42:33): 1. index.html <!DOCTYPE html> <html lang="en"> <head ...

  8. 基于jquery地图特效全国网点查看代码

    基于jquery地图特效全国网点查看代码.这是一款简单实用的jQuery地图特效,主要知识点是jquery和css实现了中图地图,提示层效果.效果图如下: 在线预览   源码下载 实现的代码. htm ...

  9. C语言 · 错误票据

    历届试题 错误票据   时间限制:1.0s   内存限制:256.0MB        锦囊1 排序. 锦囊2 把所有的编号排序,再扫描一遍数组,即可找到重复的和遗漏的.   问题描述 某涉密单位下发 ...

  10. hive之案例分析(grouping sets,lateral view explode, concat_ws)

    有这样一组搜索结果数据: 租户,平台, 登录用户, 搜索关键词, 搜索的商品结果List {"tenantcode":"", "platform&qu ...