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 Themes (unless there is something better) for specifying default values for my GUI components. I am running on Windows. In directory C:\Documents and Settings\dj\.netbeans\5.5\system I have created a file called themes.xml. For an initial test, I set some attributes for the Button component. But when I restart and run Netbeans 5.5 and create a new Button in the Matisse GUI builder, it is not using the values I provided in the themes.xml file. I want the settings in themes.xml to be used both in the GUI designer and also in final deployed application. I'd also like to understand what needs to be done to deploy this application with themes, the end user will not have Netbeans installed on their machines, so they won't have the above directory. Can I place the themes.xml file somewhere else and how to I point to it so it gets used at runtime?
Use of themes.xml is specific to NetBeans platform - it is intended only for customizing the IDE itself, it does not work for user apps. That's why it is not supported by the GUI builder. (BTW it only works with Metal look and feel.) If you are interested in the code that sets up the theme from the xml file, look at the source code of core/swing/plaf.
Is there a means of setting default values for UI component attributes that will work both in a Swing runtime environment and also in Matisse GUI builder? I am familiar with the UIDefaults capability, but is there a way this can be initialized while running the Matisse GUI builder? What would make sense is to have a facility within Matisse itself that lets you set the default values for the components. Then it could generate the code for setting Uidefaults. Then you could have the same default component values in Matisse and runtime. This much preferred over having to set the component attribute values for every single instance in the GUI design. And for many companies that have corporate-wide GUI guidelines, having such information in a file form that can be part of the Netbeans configuration will allow developers across a corporation have their corporate standards automatically have these default values, without any effort on the part of application developers starting to develop an application. Entering all these component attribute values for each instance is very labor intensive in a large application. It looked like Themes solved this problem. And most corporations would probably be willing to adopt a single L&F like Metal if it provided this capability. But having the same look also in Matisse is crucial.
So do you mean that the GUI builder should load the Metal theme you define for the application and use it also for designed components?
Not necessarily. My understanding (I am fairly new to using Swing) is that the setting of defaults in javax.swing.UIDefaults is usable across ALL Swing L&Fs. Its also my understanding that Themes provide a way to set the values in UIDefaults, but by using an XML file that contains the values. This should be possible to work completely independent of the particular L&F. It would be nice to build up the Themes.xml file through a graphical editor in Matisse, though this would take some development work. But if Matisse could simply use the Themes.xml file to set the UIDefaults value for use in the GUI designer, and then provide the necessary call in the generated code so that the application at runtime could also use the same Themes.xml file, then we could have a facility for setting UIDefaults and providing a consistent L&F in Matisse and the running application. I find it very surprising this is not currently supported.
One additional comment/question. Will it work if I write the code to set the UIDefaults, specify this in the PreCreation Code for the components, or atleast the first component that is initialized in the generated code. In other words, does the pre-Creation code actually get executed by Matisse in the GUI builder? That is another way this could work. And if the code for initializing UIDefaults from a Themes.xml file is open- source, then that could be used directly by applications too.