Java Pro Article: Styling Java UIs Using CSS
Gerald Bauer <[email protected]>
| Newsgroups | gmane.comp.lang.xul.announce |
|---|---|
| Message-ID | <[email protected]> |
Hi, I just stumbled over Philippe Kaplan's (ILOG) Java Pro article titled "Styling Java User Interfaces: Improving data display can help users perform tasks better". Philippe shows why and how to bring the CSS (Cascading Style Sheets) styling system used for web pages into the Java world. Philippe concludes: Styling Other Graphic Components: Most Swing components can be styled as we did with the JTable. However, the added value becomes more obvious as the components get more complex. This is why Table, Tree, and List are good candidates. An implementation of CSS for Java has been performed in a commercial product, ILOG JViews, a framework for displaying 2D graphics like charts, maps, and graphs. The 2D rendering engine reads input from XML files and is driven by CSS, which permits the display of data virtually without writing a line of Java code. To try a stylable workflow monitoring applet built on ILOG Jviews, go to http://www.ilog.com/products/jviews/demos/wf-monitor/index.cfm. Benefits of CSS Styling: Styling not only makes the UI more attractive, it also provides more readable and more relevant rendering. It can even become a graphic tool to dig into data and to highlight the data that verifies simple conditions, although it is not the main purpose of styling. Sometimes users do not need a full data mining system, and this simple graphic filtering is good enough to help find particular items in a table quickly. And it comes free with the styling mechanism. Further, the tuning of a UIthat is, finding the right colors, fonts, and other graphic attributes, is usually time-consuming. With CSS, the design loop is faster: Customizations of objects are gathered in a style sheet (or several style sheets). The syntax of CSS for Java is close to the true CSS, which speeds up the learning curve. Tuning the UI is simplified by the dynamicity of the implementation. No need to compile or restart the application to test a change in style, because the style can be changed while the application is running. The UI will be updated automatically. Bug tracking: the styling system is harmless. If a bug occurs, it can only happen within the bean setter invocation. The CSS engine reports this kind of error to the developer. Of course, all the other advantages of the true CSS are preserved, like cascading, inheritance, powerful pattern matching that make efficient and compact rules, and so on. UIs remain the favorite application domain of styling, because they provide the most spectacular result. However, the technology serves other purposes as well, since it basically applies property settings to beans. For instance, it works nicely for the configuration of objects, like setting the preferences of an application or its modules. Styling the UI enhances the MVC pattern and separates the business data from the UI rendering. CSS have been designed for this purpose. Their success in the Web page authoring domain proves how mature they are. However, CSS technology appears to be suitable for styling Java components as well. A proprietary styling system could probably do the job, too, but reusing a standard such as CSS, even if it needs tweaking, speeds up the learning curve to master this module of customization. For the user, the style sheets applied to customize Java UIs improve the quality of the information. Full story @ http://www.fawcette.com/javapro/2003_05/online/pkaplan_05_29_03/default_pf.asp - Gerald --------------------------------------- XUL News Wire - Subscribe/Unsubscribe @ http://lists.sourceforge.net/lists/listinfo/xul-announce --------------------------------------- ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps