This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I would like to use theming to run NetBeans with darker backgrounds and light text. org.netbeans.core.NbTheme supports primary colors and font sizes, but does not support specifying other properties of MetalTheme (which it inherits from) in XML, e.g. UserFontColor, etc. IMHO NbTheme should allow access to all of the properties available for Swing Metal L&F themes.
Created attachment 6647 [details] Patch - heavy rewrite of Themes support
Created attachment 6648 [details] Example theme file (note change in filename capitalization - will not conflict)
The attached patch is a nearly complete rewrite of themes functionality, making it much more flexible (if necessary, backward compatibility can be kept with the old version, but I think nobody is really using it and it was never offical API). The following changes were made: - Redesign of the XML format - The old format hard-coded tags for each property of MetalTheme. The new version uses a generic format, e.g. <color key="primary1" r="204" g="204" b="204/> - All tags in the new theme format are lower case, not mixed case - The expected theme file name was changed from Themes.xml to themes.xml - The old version stored MetalTheme properties in private fields. The new version stores them in UIDefaults. - The new version allows themes to address all contents of UIDefaults, not just those aspects exposed by MetalTheme - Supports tags for fonts, colors, strings, dimensions, integers and booleans - An exception thrown on startup when a theme file is not present was eliminated - Multiple themes may be active at the same time. This allows for separate sections covering things like font and scrollbar sizes, different sets of colors for different controls, etc. See the attached themes.xml file for an example. Anyway, I hope you will accept this revision to themes support! I am already enjoying it :-)
Created attachment 6649 [details] Binary patch file (put this in $NB_HOME/lib/patches and the themes.xml file in $NB_USER/system and you can try the patch)
Note - the above binary patch also contains patches for: org/openide/explorer/propertysheet/PropertyPanel org/openide/explorer/view/TableSheetCell org/openide/awt/SplittedPanel org/openide/explorer/propertysheet/PropertySheet org/openide/explorer/propertysheet/SheetButton because these classes were getting their color settings from java.awt.SystemColor rather than javax.swing.UIManager (see issues 25589 and 25590).
There is a typo in the example theme (check XML).
You forgot to add insets support. Needed to e.g. kill some of the useless space on JTabbedPane tabs.
Created attachment 6653 [details] Fixed theme file - first copy was corrupted
Created attachment 6654 [details] Example theme file including insets support
Created attachment 6655 [details] Revised source code patch including theme support & a fixing a couple missed //NOI18N's
Created attachment 6656 [details] Revised binary patch including insets support
Target milestone was changed from '3.4' to TBD.
When will be the patch put in? I'm using it over a week, and works fine. Really cool thing.
Ok Peter, you're using it, knows more about it then me, so please integrate. I can do code review if you want. Thanks.
Well, it's no problem for me to integrate it. But let me to have a little question first: Isn't it better to do by somebody who will maintain the code afterwards? I don't know whom this part belongs. I also don't know much about this issue, I'm just enjoying it like an ordinary user.
Yes, I agree - however this piece of code belongs to nobody (in past it was maintained by ui team). But ok, core/AWT/Swing is assigned to me, so it's fair to take it back. Will try to review the code and integrate changes soon.
By the way, possible longer-term enhancements we could make: 1. Permit each theme file to be in a separate XML file, with one XML file for the master theme config. Thus allow modules to add theme pieces, more or less like toolbars. 2. Provide a GUI (Options) for turning on and off themes interactively. Could update UI for some sample JPanel with typical components (not live IDE - too many problems). 3. Provide a GUI for editing particular themes - not clear how exactly, but ability to add new properties to the configured list, and use of standard property editors for the values (font chooser etc.).
patch integrated in main trunk, together with patches for 25589 and 25590. Thanks for support.