/**
   * Update the display to show the information about the specified example.
   *
   * @param example the currently-selected example
   */
  private void display(Example example) {
    if (example == null) {
      tabbedPane.removeAll();
      runButton.setEnabled(false);
    } else {
      tabbedPane.removeAll();

      JEditorPane description = new JEditorPane();
      description.setContentType("text/html");
      description.setText(example.getDescription());
      description.setEditable(false);

      description.addHyperlinkListener(
          new HyperlinkListener() {

            @Override
            public void hyperlinkUpdate(HyperlinkEvent hle) {
              if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType())) {
                Desktop desktop = Desktop.getDesktop();

                try {
                  desktop.browse(hle.getURL().toURI());
                } catch (Exception ex) {
                  // unable to launch browser
                }
              }
            }
          });

      tabbedPane.addTab("Description", description);

      for (String resource : example.getResources()) {
        try {
          RSyntaxTextArea textArea = new RSyntaxTextArea(20, 60);

          if (resource.endsWith(".java")) {
            textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
          } else {
            textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE);
          }

          textArea.setCodeFoldingEnabled(true);
          textArea.setText(load(resource));
          textArea.setSelectionStart(0);
          textArea.setSelectionEnd(0);
          textArea.setEditable(false);
          RTextScrollPane sp = new RTextScrollPane(textArea);

          tabbedPane.addTab(new File(resource).getName(), sp);
        } catch (IOException ex) {
          ex.printStackTrace();
        }
      }

      if (example.getMainClass() == null) {
        runButton.setEnabled(false);
      } else {
        runButton.setEnabled(true);
      }
    }
  }