Issue
I need to make a change to this class, there is no way for me to just subclass in normal way. So I can modify the java file (or make a copy of it) but how do I get my Swing application to use this version instead of the one provided by the Java runtime?
What I am trying to do is make a copy of com.sun.java.swing.plaf.windows.WindowsTableHeaderUI and fix it, so I cant just create a copy of the class sand put it into my own pacakage hierachy as I dont have access to many of the classes referred to in the class (such as XPStyle) so how do i replace the system class?
Solution
So I got it working as follows:
Copied the following files from src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows -
WindowsTableHeaderUI.java,TMSchema.java,XPStyle.javainto my code treeModified the package statement for these three files to match they have been placed
Added the following to allow the internal classes to be found
--add-exports java.desktop/sun.awt.windows=ALL-UNNAMED
--add-exports java.desktop/sun.awt.image=ALL-UNNAMED
--add-exports java.desktop/sun.swing.table=ALL-UNNAMED
--add-exports java.desktop/sun.swing=ALL-UNNAMED
--add-exports java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED --add-exports java.base/sun.security.action=ALL-UNNAMED
A few minor changes to allow classes to compile
Implemented my fix for the WindowsTableHeaderUI class
Used in application but only if on Windows with
if(Platform.isWindows()) { UIManager.put("TableHeaderUI","com.jthink.jaikoz.tablerenderer.windows.WindowsTableHeaderUI"); }
Answered By - Paul Taylor
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.