Learn about XUL, a subset of XML used to describe user interfaces, that helps you to make rich user interfaces with nothing more complicated than a text editor. In the sixth part of this series learn about XBL, another of XML’s many faces and a partner in crime with XUL, also called XML Binding Language.
Once that is saved delete the chrome.rdf file from the Mozilla chrome directory and then launch Mozilla. The XUL file is reference in the same was as before, and once open, you will see the changes laid out in the example stylesheet. Adding alternative locale files to you applications is done in a similar way, using contents.rdf files to describe them and DTD instead of CSS Files.
If you’re creating multiple skins, it would be wise to package them up in JAR files yourself. When doing this, the format that you use to register them in the installed-chrome.txt file changes. You should store your own JAR archive in the Mozilla chrome folder along with the others and add the next line of code to the bottom of the file:
If you have a directory structure within the JAR file, the location of the stylesheet will need to come directly are the exclamation mark, so if there was folder inside the JAR file called skin, then a folder inside that called metallic, which contained a stylesheet that gave interface elements a silver and grey colour scheme, the line of code would need to read:
The concepts in this article have related to defining element bindings using XBL and stylesheets, and changing the theme of your applications by using skins. What I’ve shown you is just the beginning, there is far more than the scope of these articles can hope to include.
XUL is an incredibly easy language to learn and is effective and powerful in what it can do. I hope that this introduction to it will inspire you to learn more and to put this newfound knowledge into projects of your own to create new applications.