Hi,

  Joshua Marinacci wrote-up an article for Sun's
Java.Net site titled "Swing and CSS" showing how you
can use CSS (Cascading Style Sheets) to style your
Swing widgets.

    Joshua writes:

Why can't we use something like CSS? A running Swing
application is basically a tree of objects, so
couldn't we apply the style at runtime as rules laid
on top of the tree? By analogy, web pages are
represented as the document object model (or DOM),
which, for our purposes, means a tree of objects, one
object for each element (paragraph, text field, image,
etc.). CSS is a set of styles (such as colors and
fonts) applied to the objects according to rules. The
rules are described in the top of the web page or in a
separate file, using the CSS syntax. The rules can be
simple (make all P elements be bold) or complex (make
every other P node inside of each span node named
"header" be bold).

We are going to do the same thing with Swing. Instead
of HTML nodes, we have Swing components. The rules
will be described in an external XML file that we will
apply at runtime. 


  Great insight. I guess in two years Joshua will
figure out that you can also create your Swing UIs
using HTML-like XML tags instead of hardwiring the
layout and widget tree with Java spaghetti code.
      
  Anyway, Joshua is not all talk but also wipes up a
little demo to proof the concept.
    
   Full story @
http://today.java.net/pub/a/today/2003/10/14/swingcss.html

  - Gerald


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
xul-announce mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xul-announce

Reply via email to