I have spent the better part of the day trying to figure out this icon rendering bug and beginning to suspect that it is something behind the scenes that I am not aware of. Any help will be greatly appreciated.
In my MultiMarkdown plugin I use HTML <INPUT TYPE=CHECKBOX> to create task lists and custom bullets that are rendered by HTMLEditorKit. I set the icons for the control after creation: normal, disabled, selected, disabled-selected. Everything works fine if the Application Theme is Default.
I allow the user to select the HTML Preview Theme separate from the Application theme and both HTML Preview default.css and darcula.css work as expected when UI is Default. The only difference between the two stylesheets is color settings, I did a diff just to make sure. The icons all have _dark.png, @2x.png and @2x_dark.png variations. On my retina mac the hires icons are used, as expected. Here are the two stylesheets rendered with Default Application UI:
However, when I switch the Settings Appearance to Darcula this is what I am getting for the custom Icons and themes. The painting of them is offset and that is definitely not in my code since I provide the icons as files and they are fine. I have tripple and quadruple checked what they look like in IntelliJ IDEA, and all icons have the same dimensions and image placement within the tile, the issue is really in how they are rendered when the Theme is Darcula.
When I create the component for the FormView:
c = super.createComponent();
JCheckBox chk = (JCheckBox) c;
Icon openTask = isInverted ? MultiMarkdownIcons.OPEN_TASK_INV : MultiMarkdownIcons.OPEN_TASK;
Icon closedTask = isInverted ? MultiMarkdownIcons.CLOSED_TASK_INV : MultiMarkdownIcons.CLOSED_TASK;
The icon ending in _INV has the same set of icons as the non-inverted version but they are reversed, _INV has dark ones, _INV_DARK has light ones. They are physical copies of the non-inverted icons. I use them when the Preview Theme and the Application theme are opposites so that the right icons get selected by IconLoader.getIcon(). I use a bash script to make the copies:
cp $ICONS/bullet.png $ICONS/bullet_inv_dark.png
cp $ICONS/bullet_dark.png $ICONS/bullet_inv.png
cp $ICONSfirstname.lastname@example.org $ICONS/bullet_inv@2x_dark.png
cp $ICONS/bullet@2x_dark.png $ICONSemail@example.com
cp $ICONS/opentask.png $ICONS/opentask_inv_dark.png
cp $ICONS/opentask_dark.png $ICONS/opentask_inv.png
cp $ICONSfirstname.lastname@example.org $ICONS/opentask_inv@2x_dark.png
cp $ICONS/opentask@2x_dark.png $ICONSemail@example.com
cp $ICONS/closedtask.png $ICONS/closedtask_inv_dark.png
cp $ICONS/closedtask_dark.png $ICONS/closedtask_inv.png
cp $ICONSfirstname.lastname@example.org $ICONS/closedtask_inv@2x_dark.png
cp $ICONS/closedtask@2x_dark.png $ICONSemail@example.com
I have eliminated all posibilities that I could think of and don't know what else to try. Any help or pointers would be greatly appreciated.