CSS In Action (Styling Swing UI)

Gerald Bauer <[email protected]>
Newsgroups gmane.comp.embedded.carlsbad-cubes
Message-ID <[email protected]>
Hello

> I wanted to set the font,color etc. for
> command,radio button etc. at one
> place, otherwise you have to write it in each XML
> file.

  For some insight allow me to post a XUL file that
uses some inline CSS from the Luxor XUL toolkit. Here
we go:

     <!-- ==================================== -->
     <!-- border-style double examples         -->
     <!-- ==================================== -->

     <hbox style="height: 30; border: double;">
        <label value="border: double;" />
     </hbox>
     
     <hbox style="height: 30; border: double 2;">
        <label value="border: double 2; "/>
     </hbox>
     
     <hbox style="height: 30; border: double 3 aqua;">
        <label value="border: double 3 aqua; "/>
     </hbox>

     <!-- ==================================== -->
     <!-- border-style misc effects examples   -->
     <!-- ==================================== -->
     
     <hbox style="height: 30; border: groove">
        <label value="border: groove" />
     </hbox>
     
     <hbox style="height: 30; border: ridge;">
        <label value="border: ridge;" />
     </hbox>
     
     <hbox style="height: 30; border: inset;">
        <label value="border: inset;" />
     </hbox>
     
     <hbox style="height: 30; border: outset;">
         <label value="border: outset;" />
     </hbox>
     

       <label value="Luxor Rocks - font: sans-serif"  
 
              style="font: sans-serif; color: red" />
	      
       <label value="Luxor Rocks - font: 20
sans-serif" 
              style="font: 20 sans-serif; color:
green" />
	      
       <label value="Luxor Rocks - font: 15 italic
sans-serif" 
              style="font: 15 italic sans-serif;
color: white; background: black;" />
	     
       <label value="Luxor Rocks - font: 15 bold
sans-serif" 
              style="font: 15 bold sans-serif;" />
	      
       <label value="Luxor Rocks - font: 13 italic
bold sans-serif" 
              style="font: 13 italic bold sans-serif;"
/>

       <label value="Luxor Rocks - font: serif"       
 
              style="font: serif;" />
	      
       <label value="Luxor Rocks - font: monospace"   
 
              style="font: monospace;" />
	      
       <label value="Luxor Rocks - font: 15 monospace"
 
              style="font: 15 monospace;" />

       <button label="Luxor Rocks - font: 15
monospace"  
              style="font: 15 monospace;" />	      
	      
       <textbox value="Luxor Rocks - font: 17 bold
monospace"
              style="font: 17 bold monospace;" />
	      
       <textbox value="Luxor Rocks - font: 17 bold
monospace; background: black; color: green; align:
right;"
              style="font: 17 bold monospace;
background: black; color: green; align: right;" />
	      
       <label value="Luxor Rocks - align: right" 
              style="font: 20 sans-serif; align:
right;" />

       <label value="Luxor Rocks - align: center" 
              style="font: 20 sans-serif; align:
center;" />

       <label value="Luxor Rocks - align: left" 
              style="font: 20 sans-serif; align:
left;" />
	      
   and so on and so forth

   - Gerald

PS: For an example of using external CSS stylesheets
for Swing UIs check out the XUL News Wire story titled
"Luxor XUL Now Sports External CSS Stylesheets" online
@
http://article.gmane.org/gmane.comp.lang.xul.announce/197

PPS: Just to clarify I'm a big fan of SwixML and I
don't want you to switch to Luxor. I encourage you to
add CSS support to SwixML. It's easier than you think.

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.