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. 如何让 zend studio 10 识别 Phalcon语法并且进行语法提示

    让 zend studio 10 识别 Phalcon语法并且进行语法提示 https://github.com/rogerthomas84/PhalconPHPDoc 下载解压后,把里面 phalc ...

  2. Specular Aliasing与Specular Leaking

    最近做高质量实时HDR PBR渲染中碰到了2个关键问题,若干思考如下: 问题1: 极高的动态范围HDR+高级BRDF+相对较低的采样率(比方说不考虑子像素的原始分辨率),在这3项因素的综合作用下,Sp ...

  3. linux如何查看一个进程的堆栈

    转自:http://blog.csdn.net/nanjingligong/article/details/8624739 方法一:pstack pidNAME       pstack - prin ...

  4. [DIOCP3-说明书] 关于DEMO的编译

    总有些朋友问我,关于DEMO编译的一些问题,每次都回答大概都差不多,我想还是写篇说明书给大家,关于DEMO编译的步骤.   [环境设定] 1.将DIOCP3\source路径添加到Delphi的搜索路 ...

  5. 关于一点pthread_cond_t条件锁的思考以及实验

    转:http://blog.csdn.net/aniao/article/details/5802015 APUE上,关于条件锁.其中有这么几条总结: 1.使用条件锁前必须先锁住对应的互斥锁. 2.条 ...

  6. Redhat6.5安装DB2 Express-C版本

    Linux Redhat6.5安装DB2 Express-C版本: 创建相关用户和组 创建用户组: groupdel db2iadm1 groupadd -g 999 db2iadm1 groupad ...

  7. C#学习笔记(23)——C#将PPT批量转为JPG(aspose方法)

    说明(2017-7-31 18:30:25): 1. 最主要的是下载到aspose的破解文件,我在这里下载的http://www.lenosoft.net/down/10205.htm,如果不差钱可以 ...

  8. Android NFC近场通信1——NFC概述

    最近对NFC挺感兴趣,而且新换的手机也支持NFC功能(最近换了Find5,感觉还不错O(∩_∩)O),所以打算学学NFC编程.NFC就是我们经常说的近场通信.通常距离是4厘米或更短.NFC工作频率是1 ...

  9. 多平台的网站实现单点登录系统(SSO)的开发思路 让你的会员中心更加统一(参考资料)

    单点登录并不是一个新鲜的玩意儿,比较官方的解释是企业业务整合的解决方案之一,通俗来讲SSO就是一个通用的用户中心,国内比较流行的UCenter就是一套单点登录解决方案.而近期以CSDN明文存储用户密码 ...

  10. [zigbee]zigbee的一些基础

    --------------------------下面转自知乎 首先要区分协议跟协议栈.◇协议是一种规定.是一系列的通信标准,通信双方按照这一标准进行数据收发.◇协议栈是一系列代码,是协议的具体实现 ...