Browse by category:
|| | ||
Column titles using center justification disappear when implementing a grid using JFC/Swing. Equivalent AWT grids display the titles correctly.
The problem occurs in the drawImageLabel method of the GXLabel class. When the center alignment is used, the following code is not executed correctly within the current version of the JIT compiler (JDK 1.1.6). The JIT runs by default when Java is executed on Win32 platforms.
xp += width/2-fm.stringWidth(str)/2; g.drawString(str, xp, y-fm.getDescent() + (int)(height+nTextHigh)/2);
The value returned for the xp variable is not correct. The value returned for y-fm.getDescent() + (int)(height+nTextHigh)/2 is also incorrect.
It appears that the JIT may be attempting to optimize the code, which is causing an error in the calculation.
The problem can be solved by using the shift operation instead of the simple division originally used in the GXLabel class.
This change is equivalent in function to the original code, but is implemented to avoid the problem caused by JIT error.
A modified copy of the GXLabel.java is available below to temporarily modify the code until a new JIT is available which corrects this problem. To implement this modification, this file should be recompiled to replace the existing .class file in the Grid.J source code for JFC.Download the modified GXLabel.java file
|GXLabel.java (13 kb)|
|StudioJ product unlock code not accepted during installation||Retrieving return parameters from oracle Storedprocedures|