<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Depth-First: Tag swing</title>
    <link>http://depth-first.com/articles/tag/swing</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Walking the Web of Chemical Informatics</description>
    <item>
      <title>Because Mistakes Happen: Giving ChemPhoto Some Poka-yoke</title>
      <description>&lt;p&gt;&lt;a href="http://rhjr.net/dto/"&gt;&lt;img src="http://depth-first.com/demo/20070928/book.jpg" align="right"&gt;&lt;/img&gt;&lt;/a&gt;One of the difficulties in creating applications that can write to a user's filesystem is dealing with the real possibility that a simple, honest, garden-variety mistake can result in consequences ranging from the mildly frustrating to the disastrous.&lt;/p&gt;

&lt;p&gt;As a specific example, consider Omar, who has just created 15,000 SVG images from an SD file with &lt;a href="http://metamolecular.com/chemphoto"&gt;ChemPhoto&lt;/a&gt; (the first &lt;a href="http://depth-first.com/articles/2008/09/08/smarter-cheminformatics-from-sd-file-to-image-collection-with-chemphoto"&gt;chemical structure imaging application&lt;/a&gt;). Continuing on, he opens a second SD file to create images from it. Forgetting to change the output directory for his images, Omar presses the "Create" button, only to find that the new images are overwriting the old images. By the time he presses "Cancel", the damage has been done. Omar has to go back to the first SD file and create all 15,000 SVG images again.&lt;/p&gt;

&lt;p&gt;In his book &lt;em&gt;&lt;a href="http://rhjr.net/dto/"&gt;Designing the Obvious&lt;/a&gt;&lt;/em&gt;, Robert Hoekman, Jr. describes user interface elements designed to prevent the user from making mistakes. He calls them Poka-yoke devices (POH-kay YOH-kay, from the Japanese for "mistake-proofing").&lt;/p&gt;

&lt;p&gt;It's possible to spare Omar from his self-inflicted inconvenience (or a far more serious kind of mistake) by building some Poka-yoke devices into ChemPhoto.&lt;/p&gt;

&lt;p&gt;A single dialog box controls the generation of images in ChemPhoto. The image below shows that it requires a name for the collection. Notice that without this, the name field is highlighted, a message appears at the bottom, and the "Create" button is deactivated.&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;a href="http://depth-first.com/demo/20080917/choose_name_full.png"&gt;&lt;img src="http://depth-first.com/demo/20080917/choose_name_thumb.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;If Omar chooses a non-existing output directory, he'll similarly get a warning and be prevented from continuing:&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;a href="http://depth-first.com/demo/20080917/warning_directory_full.png"&gt;&lt;img src="http://depth-first.com/demo/20080917/warning_directory_thumb.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;If Omar chooses a directory and collection name combination that will result in a directory (or archive file) being overwritten, he gets a warning and is blocked from going forward:&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;a href="http://depth-first.com/demo/20080917/warning_overwrite_full.png"&gt;&lt;img src="http://depth-first.com/demo/20080917/warning_overwrite_thumb.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;When Omar has provided all of the necessary information and there's no chance he can overwrite any of his existing files, ChemPhoto clears the error messages, removes the error highlighting, and activates the "Create" button (he's also told exactly what ChemPhoto will be writing to his hard drive):&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;a href="http://depth-first.com/demo/20080917/alles_klar_full.png"&gt;&lt;img src="http://depth-first.com/demo/20080917/alles_klar_thumb.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;This functionality could have been implemented by letting Omar fill in all the fields, with error or not. If some conflict (such a directory overwrite) were detected, Omar could get a warning dialog, and be told to go back to the form to fix it. But why put him to all that trouble when designing the right interface from the start can prevent it?&lt;/p&gt;

&lt;p&gt;Catching errors as they occur and providing feedback in real-time gives the best of both worlds in a form that can be filled out quickly and safely.&lt;/p&gt;

&lt;p&gt;ChemPhoto is approaching its first alpha release. If you're interested in trying it, please  &lt;a href="http://mailhide.recaptcha.net/d?k=01R9bxyP6XNdc0duoUCzBBHA==&amp;amp;c=vZ7R0VDctRzIRzbSs1-LZwDzjTjAnfCS4KONqGHxY9I=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01R9bxyP6XNdc0duoUCzBBHA==&amp;amp;c=vZ7R0VDctRzIRzbSs1-LZwDzjTjAnfCS4KONqGHxY9I=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address"&gt;drop me a line&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Wed, 17 Sep 2008 16:00:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:81c473bf-1cb3-47be-a27c-32da8302c1f4</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/09/17/because-mistakes-happen-giving-chemphoto-some-poka-yoke</link>
      <category>Tools</category>
      <category>designingtheobvious</category>
      <category>pokayoke</category>
      <category>chemphoto</category>
      <category>swing</category>
      <category>java</category>
    </item>
    <item>
      <title>Imaging Chemical Structures with ChemPhoto: WYSIWYG Drawing Settings</title>
      <description>&lt;p&gt;&lt;a href="http://metamolecular.com/chemphoto"&gt;&lt;img src="http://depth-first.com/demo/20080908/chemphoto.png" align="right"&gt;&lt;/img&gt;&lt;/a&gt;Depending on the audience and medium, chemical structures can be presented in a variety of styles. &lt;a href="http://depth-first.com/articles/2008/09/08/smarter-cheminformatics-from-sd-file-to-image-collection-with-chemphoto"&gt;Chemical structure imaging applications&lt;/a&gt; should make it easy to visually and/or numerically arrive at the best appearance. &lt;a href="http://metamolecular.com/chemphoto"&gt;ChemPhoto&lt;/a&gt; makes it easy to get exactly the right look for your structures through what-you-see-is-what-you-get (WYSIWYG) drawing settings.&lt;/p&gt;

&lt;p&gt;The screenshots below illustrate the three main categories of drawing settings in ChemPhoto: Atoms; Bonds; and Images. As each setting is manipulated, the entire view is updated in real-time to reflect the changes. A set of changes can be rolled back by pressing the "Cancel" button, making it easy to undo unwanted modifications.&lt;/p&gt;

&lt;h4&gt;Turquoise Theme with Atoms Tab&lt;/h4&gt;

&lt;p&gt;&lt;center&gt;&lt;a href="http://depth-first.com/demo/20080911/atoms_tab_large.png"&gt;&lt;img src="http://depth-first.com/demo/20080911/atoms_tab_small.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;h4&gt;Console Theme with Bonds Tab&lt;/h4&gt;

&lt;p&gt;&lt;center&gt;&lt;a href="http://depth-first.com/demo/20080911/bonds_tab_large.png"&gt;&lt;img src="http://depth-first.com/demo/20080911/bonds_tab_small.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;h4&gt;Blueprint Theme with Images Tab&lt;/h4&gt;

&lt;p&gt;&lt;center&gt;&lt;a href="http://depth-first.com/demo/20080911/images_tab_large.png"&gt;&lt;img src="http://depth-first.com/demo/20080911/images_tab_small.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;To try an alpha version of ChemPhoto for yourself,  &lt;a href="http://mailhide.recaptcha.net/d?k=01R9bxyP6XNdc0duoUCzBBHA==&amp;amp;c=vZ7R0VDctRzIRzbSs1-LZwDzjTjAnfCS4KONqGHxY9I=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01R9bxyP6XNdc0duoUCzBBHA==&amp;amp;c=vZ7R0VDctRzIRzbSs1-LZwDzjTjAnfCS4KONqGHxY9I=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address"&gt;drop me a line&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Thu, 11 Sep 2008 15:44:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:1a4c8370-26ae-4930-9154-daf76b0db004</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/09/11/imaging-chemical-structures-with-chemphoto-wysiwyg-drawing-settings</link>
      <category>Tools</category>
      <category>chemphoto</category>
      <category>chemicalstructureimaging</category>
      <category>imaging</category>
      <category>java</category>
      <category>pubchem</category>
      <category>swing</category>
      <category>screenshots</category>
      <category>wysiwyg</category>
    </item>
    <item>
      <title>ChemPhoto Screenshots: Appearance of Structures and Browsing Large Collections</title>
      <description>&lt;p&gt;Chemical structure imaging software solves the problem of how to easily create large numbers of readable chemical structures in a variety of formats automatically. &lt;a href="http://metamolecular.com/chemphoto"&gt;ChemPhoto&lt;/a&gt; was recently &lt;a href="http://depth-first.com/articles/2008/09/08/smarter-cheminformatics-from-sd-file-to-image-collection-with-chemphoto"&gt;introduced&lt;/a&gt; as what appears to be the first chemical structure imaging application. With development of the ChemPhoto user interface now in full-swing, it's possible to show some screenshots.&lt;/p&gt;

&lt;p&gt;Below are two screenshots in which around 25,000 structures from &lt;a href="http://depth-first.com/articles/2006/09/29/hacking-pubchem-direct-access-with-ftp"&gt;PubChem&lt;/a&gt; have been loaded.&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;a href="http://depth-first.com/demo/20080910/chemphoto_large_black.png"&gt;&lt;img src="http://depth-first.com/demo/20080910/chemphoto_small_black.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;a href="http://depth-first.com/demo/20080910/chemphoto_large_white.png"&gt;&lt;img src="http://depth-first.com/demo/20080910/chemphoto_small_white.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;If you're interested in trying an alpha version ChemPhoto, feel free to &lt;a href="http://mailhide.recaptcha.net/d?k=01R9bxyP6XNdc0duoUCzBBHA==&amp;amp;c=vZ7R0VDctRzIRzbSs1-LZwDzjTjAnfCS4KONqGHxY9I=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01R9bxyP6XNdc0duoUCzBBHA==&amp;amp;c=vZ7R0VDctRzIRzbSs1-LZwDzjTjAnfCS4KONqGHxY9I=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address"&gt;drop me a line&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Wed, 10 Sep 2008 14:55:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:8de96f1e-bfbc-4574-8b26-7dffd06f71f3</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/09/10/chemphoto-screenshots-appearance-of-structures-and-browsing-large-collections</link>
      <category>Tools</category>
      <category>chemphoto</category>
      <category>imaging</category>
      <category>chemicalstructureimaging</category>
      <category>java</category>
      <category>swing</category>
      <category>pubchem</category>
    </item>
    <item>
      <title>Filthy Rich Clients</title>
      <description>&lt;p&gt;&lt;center&gt;&lt;a href="https://aerith.dev.java.net/"&gt;&lt;img src="http://depth-first.com/demo/20080129/aerith.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;If you wind the clock back enough years, the world of graphical user interfaces was ruled by standardized look-and-feel specifications. This approach was taken in an effort to centralize all of the GUI coding in applications, make it easy to document the application (everyone knows what a slider does, therefore it doesn't need to be described), and work around the relatively poor graphics performance of desktop computers.&lt;/p&gt;
    
    &lt;p&gt;But the last decade's collision between the computer industry and the consumer has led to a huge increase in the emphasis on aesthetics in user interfaces: for everything from brand awareness to increasing the comprehensibility of sophisticated systems, to eye-catching coolness to draw the customer in, to just plain "Wow!" ... Aesthetics are &lt;em&gt;in&lt;/em&gt;.&lt;/p&gt;
    
    &lt;p&gt;-&lt;cite&gt;James Gosling, Forward to &lt;em&gt;&lt;a href="http://www.filthyrichclients.com/"&gt;Filthy Rich Clients&lt;/a&gt;&lt;/em&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The "destandardization" of the GUI has been underway for several years. From Web applications like &lt;a href="http://www.picnik.com/"&gt;Picnik&lt;/a&gt; to &lt;a href="http://youtube.com"&gt;Flash video players&lt;/a&gt; to Apple's &lt;a href="http://www.apple.com/itunes/download/"&gt;iTunes application&lt;/a&gt;, users are getting increasingly used to the idea that not every program needs to look like Microsoft Office, and that some of them never should have in the first place.&lt;/p&gt;

&lt;p&gt;Now, it's possible to infuse Java Swing applications with the look and feel of this new breed of GUI. The new book &lt;a href="http://www.filthyrichclients.com/"&gt;&lt;em&gt;Filthy Rich Clients&lt;/em&gt;&lt;/a&gt; shows how. Covering topics ranging from threading to animation to compositing, this well-written book is a goldmine for anyone wanting to break out of a GUI rut.&lt;/p&gt;

&lt;p&gt;The use of reflections, animation, fading and the like in serious applications may seem frivolous. But used in the proper context, these effects can add a great deal to usability and appeal.&lt;/p&gt;

&lt;p&gt;Today's frivolous use of memory and CPU cycles has a strange way of becoming next year's must-have feature.&lt;/p&gt;</description>
      <pubDate>Tue, 29 Jan 2008 13:52:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:1a2bf53d-14b7-42ce-b231-f729b7bbad0e</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/01/29/filthy-rich-clients</link>
      <category>Tools</category>
      <category>gui</category>
      <category>destandardization</category>
      <category>swing</category>
      <category>2d</category>
      <category>graphics</category>
      <category>aerith</category>
    </item>
    <item>
      <title>Swing Sightings: LigandScout</title>
      <description>&lt;p&gt;&lt;a href="http://depth-first.com/demo/20080124/screenshot_large.png"&gt;&lt;img src="http://depth-first.com/demo/20080124/screenshot_small.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Source: &lt;a href="http://www.inteligand.com/ligandscout/"&gt;LigandScout&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 24 Jan 2008 08:23:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:0e3e31e6-f7cd-4d09-bbeb-9620267774a9</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/01/24/swing-sightings-ligandscout</link>
      <category>Tools</category>
      <category>inteligand</category>
      <category>ligandscout</category>
      <category>java</category>
      <category>swing</category>
      <category>swingsightings</category>
    </item>
    <item>
      <title>Swing Sightings: Chenomx NMR Suite</title>
      <description>&lt;p&gt;&lt;center&gt;&lt;a href="http://depth-first.com/demo/20080116/screenshot_large.png"&gt;&lt;img src="http://depth-first.com/demo/20080116/screenshot.png"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From: &lt;a href="http://www.chenomx.com/products/index.html#overview"&gt;Chenomx NMR Suite&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 16 Jan 2008 09:43:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:9432b2c3-6fb3-42fc-8e5a-de086fcefaa3</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2008/01/16/swing-sightings-chenomx-nmr-suite</link>
      <category>Tools</category>
      <category>chenomx</category>
      <category>nmrsuite</category>
      <category>nmr</category>
      <category>swing</category>
      <category>java</category>
    </item>
    <item>
      <title>Building a Molecule Preview with Firefly: The Joy of Swing</title>
      <description>&lt;p&gt;Previous articles have discussed &lt;a href="http://depth-first.com/articles/tag/firefly"&gt;Firefly&lt;/a&gt;, the codename for a new 2D structure editor for the Web. Although it can be deployed as a self-contained applet on Web pages, Firefly is composed of modules that are readily re-used. By taking advantage of this design and Java's native UI toolkit Swing, new UI elements can be built with relatively little effort. This article outlines one such use - the creation of a file dialog that contains a molecule preview.&lt;/p&gt;

&lt;p&gt;Many image processing applications such as Photoshop or GIMP provide an image preview that appears in file browser dialogs. Wouldn't it be nice if applications that process molecular structure files came with a similar feature? The screenshot below shows a file chooser with an embedded molecule preview based of Firefly's Painter component:&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;img src="http://depth-first.com/demo/20070718/dialog1.png"&gt;&lt;/img&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;When a new molfile is highlighted, a new preview is automatically generated:&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;img src="http://depth-first.com/demo/20070718/dialog2.png"&gt;&lt;/img&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;The molecule preview is capable of all of the customizations available in Firefly including background, bond, and atom colors, borders, and atom label fonts. No matter how large or small the molecule, and regardless of its starting coordinates, it will always be exactly scaled to fit the available space and precisely centered.&lt;/p&gt;

&lt;p&gt;This dialog was rapidly implemented using the accessory capability provided by Swing's &lt;tt&gt;JFileChooser&lt;/tt&gt;:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_java "&gt;JFileChooser chooser = new JFileChooser();
PreviewAccessory accessory = new PreviewAccessory(chooser);

accessory.setPreferredSize(new Dimension(150, 150));

chooser.setAccessory(accessory);
chooser.addPropertyChangeListener(accessory);

// ...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Defining a JComponent implmenting the &lt;tt&gt;PropertyChangeListener&lt;/tt&gt; interface is all that's needed to get a working molecule preview:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_java "&gt;class PreviewAccessory extends DefaultPainter implements PropertyChangeListener
{
  // implementation
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Swing has come a long way since the dark days of JDK 1.2. What started out as the dog-slow ugly duckling of user interface toolkits has developed into one of the best platforms for building desktop applications out there. Advanced tools such as the WYSIWYG interface builder &lt;a href="http://www.netbeans.org/kb/articles/matisse.html"&gt;Matisse&lt;/a&gt; and the polished components offered by &lt;a href="http://www.jidesoft.com/"&gt;JIDE&lt;/a&gt; make Swing an even more attractive option. The example described here is just one instance of how Swing's well-conceived design simplifies the job of building rich user interfaces.&lt;/p&gt;</description>
      <pubDate>Wed, 18 Jul 2007 06:52:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:33a3bc07-253a-4221-a8ae-46a77a47076a</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2007/07/18/building-a-molecule-preview-with-firefly-the-joy-of-swing</link>
      <category>Tools</category>
      <category>firefly</category>
      <category>filechooser</category>
      <category>swing</category>
      <category>painter</category>
      <category>preview</category>
    </item>
  </channel>
</rss>
