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的更多相关文章
随机推荐
- marquee标签详解
<marquee>标签,它是成对出现的标签,首标签<marquee>和尾标签</marquee>之间的内容就是滚动内容.<marquee>标签的属性主要 ...
- unity, 模拟退后台
//simulateSwitchToBackground.cs using UnityEngine;using System.Collections;using System.Collections. ...
- IOS团队开发之——CocoaPods 第三方库管理工具
使用前需要下载ruby 的gem 命令镜像,mac 下自带有.但一般不用,直接访问国外网站有限制. 下面安装 http://ruby.taobao.org/ http://blog.devtang.c ...
- Webservice超时问题
Winform客户端调用Webservice 120秒超时.对此问题,针对服务器与客户端分别作了超时设置为300S. 1. 服务器端设置超时 在 web.config 的 system.web 里添加 ...
- Stochastic Gradient Descent收敛判断及收敛速度的控制
要判断Stochastic Gradient Descent是否收敛,可以像Batch Gradient Descent一样打印出iteration的次数和Cost的函数关系图,然后判断曲线是否呈现下 ...
- 动态SQL中 实现条件参数 varchar类型的参数名称 以及模糊查询实现
set @strSQL='select * from testtable AS P WHERE P.Type='+@PType+' and P.PName ='''+@PName+''' and P. ...
- 每日英语:Foreign Tourists Skip Beijing
Overseas tourists continued to shun Beijing through 2013. shun:避开,避免,回避 Amid rising pollution and a ...
- 解密OpenTSDB的表存储优化【转】
https://yq.aliyun.com/articles/54785 摘要: 本篇文章会详细讲解OpenTSDB的表结构设计,在理解它的表结构设计的同时,分析其采取该设计的深层次原因以及优缺点.它 ...
- 【电子基础】液晶显示器原理·LCD驱动基础
LCD显示器概述 ——>液晶显示器,LCD为英文 Liquid Crystal Display的缩写,它是一种数字显示技术,可以通过液晶和彩色过滤光源,并在平面面板上产生图像. ——&g ...
- Asp.Net解析json字符串
方法一: using LitJson; string json= "{...........}"; JsonData jdData = JsonMapper.ToObject(js ...