e832. 从JTabbedPane中移动卡片
To move a tab, it must first be removed and then reinserted into the tabbed pane as a new tab. Unfortunately, since there is no object that represents a tab, it is necessary to record all of the tab's properties before moving it and to restore them after the new tab has been created.
This example moves the last tab to the first position:
// To create a tabbed pane, see e828 创建JTabbedPane int src = pane.getTabCount()-1;
int dst = 0; // Get all the properties
Component comp = pane.getComponentAt(src);
String label = pane.getTitleAt(src);
Icon icon = pane.getIconAt(src);
Icon iconDis = pane.getDisabledIconAt(src);
String tooltip = pane.getToolTipTextAt(src);
boolean enabled = pane.isEnabledAt(src);
int keycode = pane.getMnemonicAt(src);
int mnemonicLoc = pane.getDisplayedMnemonicIndexAt(src);
Color fg = pane.getForegroundAt(src);
Color bg = pane.getBackgroundAt(src); // Remove the tab
pane.remove(src); // Add a new tab
pane.insertTab(label, icon, comp, tooltip, dst); // Restore all properties
pane.setDisabledIconAt(dst, iconDis);
pane.setEnabledAt(dst, enabled);
pane.setMnemonicAt(dst, keycode);
pane.setDisplayedMnemonicIndexAt(dst, mnemonicLoc);
pane.setForegroundAt(dst, fg);
pane.setBackgroundAt(dst, bg);
| Related Examples |
e832. 从JTabbedPane中移动卡片的更多相关文章
- e839. 使JTabbedPane中的卡片可滚动
By default, all the tabs in a tabbed pane are displayed. When the tabs are wider than the width of t ...
- e840. 监听JTabbedPane中选中卡片的改变
A tabbed pane fires a change event whenever the selected tab is changed either by the user or progra ...
- e838. 使JTabbedPane中的卡片能用按键的方式选取
Setting a mnemonic on a tab allows the tab to be selected with a keystroke. For example, if the mnem ...
- e833. 获得JTabbedPane中的卡片
This example retrieves all the tabs in a tabbed pane: // To create a tabbed pane, see e828 创建JTabbed ...
- e835. 使JTabbedPane中的卡片生效和失效
By default, all new tabs are enabled, which means the user can select them. A tab can be disabled to ...
- 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 ...
- e837. 设置JTabbedPane中卡片的颜色
// Create a tabbed pane JTabbedPane pane = new JTabbedPane(); // Set the text color for all tabs pan ...
- e834. 设置JTabbedPane中卡片的位置
The tabs of a tabbed pane can be placed on one of the four edges of its container. By default, when ...
- e831. 从JTabbedPane中删除一个卡片
// To create a tabbed pane, see e828 创建JTabbedPane // Remove the last tab pane.remove(pane.getTabCou ...
随机推荐
- Gartner 2018新技术成熟度曲线
https://blog.csdn.net/BtB5e6Nsu1g511Eg5XEg/article/details/82047719 近日,Gartner发布了2018年新技术成熟度曲线,首次将生物 ...
- angular学习笔记(三十)-指令(3)-templateUrl
这篇主要介绍指令中的templateUrl属性: templateUrl属性值是一个url路径,路径指向一个html模板,html模板会填充(或替换)指令内容: 比如上一篇文章里的案例,我们把原来的t ...
- latex基本语法
一直想着学会latex,但是自学起来太麻烦,总是出现各种不理解的错误,也没那么多时间钻研,就学了忘,忘了再学,这里就先摘录下它的基本命令吧.学好了是一件利器!(虽然不常用,但要尽量学会) LaTex基 ...
- python argparse详解
1.argparse模块作用 用于解析命令行参数 2.位置参数和可选参数 运行以下代码: import argparse parser = argparse.ArgumentParser() args ...
- [DIOCP3/MyBean/QDAC开源项目] DataModule-DB例子基于MyBean的插件实例<三层数据库方案>
[说明] 这个例子答应大家很久了,一直没有时间弄,现在正式结合MyBean插件可以很方便的在客户端共享操作连接,执行数据库的各项工作,屏蔽了底层的通信解码器编码等工作,直接传递Variant,给了开发 ...
- [整理]Unity3D游戏开发之Lua
原文1:[Unity3D]Unity3D游戏开发之Lua与游戏的不解之缘(上) 各位朋友,大家好,我是秦元培,欢迎大家关注我的博客,我地博客地址是blog.csdn.net/qinyuanpei.如果 ...
- JAVA-JSP内置对象之request获得封装所有参数值的Map
相关资料:<21天学通Java Web开发> 获得封装所有参数值的Map1.通过request对象的getParameterMap()方法来获得封装所有的参数值的Map对象.2.通过该Ma ...
- zip伪加密
简单的话来阐述 zip伪协议的意思是说本来不需要密码的zip文件然后通过修改标志位,然后就可以达到有密码的效果对吗?但是他实际是没有密码. 一个 ZIP 文件由三个部分组成: 压缩源文件数据区+压缩源 ...
- <股市高手和你想的不一样>读书笔记
书在这里 在股市中挖掘真正有成长潜力的好企业,是成功投资者的关键 股票被低估的时候,才值得买 我们买股票,就是买这家公司的未来 公司的成长性要重点看两个方面,一个方面要看该公司近三年的成长趋势,另外一 ...
- 学习MongoDB(一) 如何在Linxu安装与启动
1.官方下载地址 https://www.mongodb.org/downloads#production,选择对应的Linxu版本. 2.mkdir -p /usr/mongodb 创建一个目录用来 ...