-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCombineColumnRender.java
More file actions
24 lines (23 loc) · 889 Bytes
/
CombineColumnRender.java
File metadata and controls
24 lines (23 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication2;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
/**
* 设置需要合并的列的单元格不能被选中,不能聚焦
* @author hualun-alan
*/
class CombineColumnRender extends DefaultTableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
CombineTable cTable = (CombineTable) table;
if (cTable.combineData.combineColumns.contains(column)) {
hasFocus = false;
}
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
}
}