Home arrow XML arrow Page 4 - An Introduction to XUL Part 6

Adding the Code to our XUL - XML

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 XMLs many faces and a partner in crime with XUL, also called XML Binding Language.

  1. An Introduction to XUL Part 6
  2. Stylesheet
  3. Customization
  4. Adding the Code to our XUL
By: Dan Wellman
Rating: starstarstarstarstar / 10
June 27, 2005

print this article



Finally, open the XUL file created in the example from the last article.  Add this code to the top of the file, just below the XML declaration:

<?xml-stylesheet href="chrome://openclose/skin/myskin.css"

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 youre 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 Ive 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.

>>> More XML Articles          >>> More By Dan Wellman

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Google Docs and Xpath Data Functions
- Flex Array Collection Sort and Filtering
- The Flex Tree Control
- Flex List Controls
- Working with Flex and Datagrids
- How to Set Up Podcasting and Vodcasting
- Creating an RSS Reader Application
- Building an RSS File
- An Introduction to XUL Part 6
- An Introduction to XUL Part 5
- An Introduction to XUL Part 4
- An Introduction to XUL Part 3
- An Introduction to XUL Part 2
- An Introduction to XUL Part 1
- XML Matters: Practical XML Data Design and M...

Developer Shed Affiliates


Dev Shed Tutorial Topics: