Closed andylan closed 10 years ago
The issue is same with another issue FIX #130 Chaotic mouse rollover painting on JTable (java8) #131 , detail please refer to https://github.com/Insubstantial/insubstantial/pull/131, and solution please refer to https://github.com/Insubstantial/insubstantial/pull/131/files
I found that JRE8(64bit) with JXTable cannot high light entire one row, like below(which is OK for JRE6(64bit) and JRE7(64bit))
I found the problem was caused class SubstanceTableUI. TableCellId method hashCode, like below:![jre8](https://cloud.githubusercontent.com/assets/1542980/3077093/33f038f8-e413-11e3-9ca0-8b4170cff70c.jpg)
public int hashCode() { //noinspection ShiftOutOfRange return (this.row ^ (this.row >>> 32)) & (this.column ^ (this.column >>> 32)); }
Which is ok for JRE6 and JRE7, but have problem with JRE8,
I used below code to do test,
public class ShiftOutOfRangeHashCode { public static void main(String[] args) { List tableCellIdLst = new ArrayList(100);
Multiset tableCellSet = HashMultiset.create();
int row = 5;
int column = 5;
TableCellId tableCellId;
for (int i = 0 ; i < row; i++) {
for (int j = 0; j < column; j++) {
tableCellId = new TableCellId(i,j);
tableCellIdLst.add(tableCellId);
tableCellSet.add(tableCellId);
}
}
}
With JDK7(64bit) test as below: "C:\Program Files\Java\jdk1.7.0_51\bin\java" Row 0, Column 0 frequency=1 Row 0, Column 1 frequency=1 Row 0, Column 2 frequency=1 Row 0, Column 3 frequency=1 Row 0, Column 4 frequency=1 Row 1, Column 0 frequency=1 Row 1, Column 1 frequency=1 Row 1, Column 2 frequency=1 Row 1, Column 3 frequency=1 Row 1, Column 4 frequency=1 Row 2, Column 0 frequency=1 Row 2, Column 1 frequency=1 Row 2, Column 2 frequency=1 Row 2, Column 3 frequency=1 Row 2, Column 4 frequency=1 Row 3, Column 0 frequency=1 Row 3, Column 1 frequency=1 Row 3, Column 2 frequency=1 Row 3, Column 3 frequency=1 Row 3, Column 4 frequency=1 Row 4, Column 0 frequency=1 Row 4, Column 1 frequency=1 Row 4, Column 2 frequency=1 Row 4, Column 3 frequency=1 Row 4, Column 4 frequency=1
But with JDK8(64bit) test as below: "C:\Program Files\Java\jdk1.8.0_05\bin\java" Row 0, Column 0 frequency=0 Row 0, Column 1 frequency=0 Row 0, Column 2 frequency=0 Row 0, Column 3 frequency=0 Row 0, Column 4 frequency=0 Row 1, Column 0 frequency=0 Row 1, Column 1 frequency=0 Row 1, Column 2 frequency=1 Row 1, Column 3 frequency=0 Row 1, Column 4 frequency=0 Row 2, Column 0 frequency=0 Row 2, Column 1 frequency=1 Row 2, Column 2 frequency=0 Row 2, Column 3 frequency=0 Row 2, Column 4 frequency=0 Row 3, Column 0 frequency=1 Row 3, Column 1 frequency=0 Row 3, Column 2 frequency=0 Row 3, Column 3 frequency=0 Row 3, Column 4 frequency=1 Row 4, Column 0 frequency=0 Row 4, Column 1 frequency=1 Row 4, Column 2 frequency=0 Row 4, Column 3 frequency=1 Row 4, Column 4 frequency=1
Here with JDK8(64bit), for some record cannot find, but which just added before.
For the problem, I can modify class SubstanceTableUI. TableCellId method hashCode, like below, and then JXTable would display OK.
Class detail please refer to https://github.com/Insubstantial/insubstantial/blob/master/substance/src/main/java/org/pushingpixels/substance/internal/ui/SubstanceTableUI.java
There is another class SubstanceMonthViewUI have the same problem