prepareEditor
@Override
public Component prepareEditor(TableCellEditor editor, int row, int column) {
final Component comp = super.prepareEditor(editor, row, column);
if (column == this.convertColumnIndexToView(this.treeRenderCol) && comp != null) {
final int r = this.convertRowIndexToModel(row), col = column; final Rectangle rect = this.getCellRect(r, column, false);
JPanel panel = new JPanel() {
private static final long serialVersionUID = -4503378912490172443L; @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
CTreeTable.this.tree.highlightBorder = null;
CTreeTable.this.tree.rowToPaint = r;
CTreeTable.this.tree.colToPaint = col;
CTreeTable.this.tree.setBounds(rect.x, 0, rect.width, 0);
Graphics g2 = null;
try {
g2 = g.create();
CTreeTable.this.tree.paint(g2);
}
finally {
if (g2 != null) {
g2.dispose();
}
}
} @SuppressWarnings("boxing")
protected boolean processCompKeyBinding(final JComponent jcomp, final KeyStroke ks, final KeyEvent e,
final int condition, final boolean pressed) {
boolean retr = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
@Override
public Boolean run() {
boolean b = false;
try {
Method m =
JComponent.class.getDeclaredMethod("processKeyBinding", KeyStroke.class,
KeyEvent.class, int.class, boolean.class);
m.setAccessible(true);
b = (Boolean) m.invoke(jcomp, ks, e, condition, pressed);
}
catch (Exception e1) {
// e1.printStackTrace();
XBRLLogger.info(e1.getMessage() + "\n" + e1.getStackTrace().toString(), true);
}
return b;
}
});
return retr;
} @Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
if (comp instanceof JComponent) {
boolean b =
this.processCompKeyBinding((JComponent) comp, ks, e, JComponent.WHEN_FOCUSED, pressed);
if (CTreeTable.this.getSurrendersFocusOnKeystroke()) {
comp.requestFocus();
}
return b;
}
return super.processKeyBinding(ks, e, condition, pressed);
} };
panel.setLayout(null);
panel.setBounds(rect);
int x = this.tree.getRowBounds(r).x;
TreeCellRenderer tcr = this.tree.getCellRenderer();
if (tcr != null && tcr instanceof DefaultTreeCellRenderer) {
DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) tcr;
x += dtcr.getIconTextGap() + dtcr.getIcon().getIconWidth();
}
comp.setBounds(x, 0, rect.width - x, rect.height);
panel.add(comp);
return panel;
}
return comp;
}
prepareEditor的更多相关文章
随机推荐
- U811.1接口EAI系列之二-BOM构成-委外BOM构成--VB语言
1.下面代码实现了VB6.0中调用U8EAI-BOM构成服务,以下代码均为项目实际代码,可直接复制应用. 2.在u811.1版本中委外BOM构成与正常的BOM构成是同系列表,不单独存储. 3.是以存货 ...
- centos 安装pecl
一.更新yum源,安装php7 CentOS/RHEL 7.x: 1 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-lates ...
- java用String类的toUpperCase()和toLowerCase()方法转字符串的大小写
1.如何判断英文字母的大小写: package com.ldw.string; import java.util.Scanner; /** * @author 作者:ldw E-mail: csu.l ...
- Matlab中classperf对象各属性解释[原创]
1.ClassLabels:类型标识.第一个label作为pos,第二次label作为neg. 2.GroundTruth:各次实验的观察值,也就是真实值. 3.ValidationCounter: ...
- Android调试桥-Android Debug Birdge详解
原文:http://android.eoe.cn/topic/summary Android调试桥-Android Debug Birdge Android调试桥(adb)是一个多功能的命令行功具,它 ...
- [na]IP分片抓包实验
这两点比较重要 1.IP+ICMP+DATA = 1500字节 2.ping size指定的是data的大小. 3,可以ping大包+不分片检测mtu(分片发生在出口,如果包尺寸大于接口ip mtu, ...
- 第九章·词典
第九章·词典 散列:原理 散列是一种赖以高效组织数据并实现相关算法的重要思想. 这样的思想背后的原理却非常直观.简单. 上图是IBM公司和联想公司的服务电话号码,能够看到这样的号码是由数字和字母共同组 ...
- FFmpeg(10)-利用FFmpeg进行视频像素格式和尺寸的转换(sws_getCachedContext(), sws_scale())
一.包含头文件和库文件 像素格式的相关函数包含在 libswscale.so 库中,CMakeLists需要做下列改动: # swscale add_library(swscale SHARED IM ...
- 构造函数 (C++)
构造函数是一种可初始化其类的实例的成员函数. 构造函数具有与类相同的名称,没有返回值. 构造函数可以具有任意数量的参数,类可以具有任意数量的重载构造函数. 构造函数可以具有任何可访问性(公共.受保护或 ...
- 对于iOS开发人工智能意味着什么
对于iOS开发人工智能意味着什么? 前言 近几年来人工智能的话题那是炙手可热.在国内很多大佬言必谈机器学习和大数据:在美国刚毕业的人工智能 PHD 也是众人追捧,工资直逼 NFL 四分卫.人工智能甚至 ...