HelpWindow.java
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 package org.gecode.explorer.swing;
00023
00024 import java.awt.*;
00025 import java.awt.event.*;
00026 import javax.swing.*;
00027 import javax.swing.event.*;
00028
00029 class HelpWindow extends JDialog implements HyperlinkListener {
00030 public HelpWindow(Frame owner) {
00031 super(owner, "Help on using the Gecode/J Explorer");
00032 setVisible(false);
00033
00034 String text =
00035 "<HEAD></HEAD><BODY>"+
00036 "<H1 align='center'>The Gecode/J Explorer</H1>"+
00037 "<P align='center'>© 2005,2006 The Gecode Team</P>"+
00038 "<P align='center'><A HREF='/'>"+
00039 "http://www.gecode.org</A></P>"+
00040 "<H2>Basic usage</H2>" +
00041 "<p>The Gecode/J Explorer visualizes the search-tree of a model. " +
00042 "Such a search-tree contains four different kinds of nodes, white, blue, red, and green." +
00043 "<dl><dt>White nodes</dt>" +
00044 "<dd>Undetermined nodes, it is known that they exist, but nothing more.</dd>" +
00045 "<dt>Blue nodes</dt><dd>Choice nodes. Theese nodes represent positions in the search tree where a choice is to be made (a brnaching).</dd>" +
00046 "<dt>Red nodes</dt><dd>Failure nodes. At these nodes a failure has been detected.</dd>" +
00047 "<dt>Green nodes</dt><dd>Solutions nodes. At these nodes, a solution has been found.</dd></dl>" +
00048 "To view the contents of a non-white node, you just have to double-click on it." +
00049 "Double-clicking on a white node will make it determined (i.e., blue, red, or green)." +
00050 "</p><p>"+
00051 "There are many more ways to explore the tree and inspect the results," +
00052 " and equally important, to visualize the tree. Commands for these "+
00053 "tasks are available in the menues." +
00054 "</p></BODY>";
00055
00056 JEditorPane ep = new JEditorPane("text/html", text);
00057 ep.setBackground(owner.getBackground());
00058 ep.setEditable(false);
00059 ep.addHyperlinkListener(this);
00060
00061
00062 JScrollPane editorScrollPane = new JScrollPane(ep);
00063 editorScrollPane.setVerticalScrollBarPolicy(
00064 JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
00065 java.awt.Point p = new java.awt.Point(0,0);
00066
00067 editorScrollPane.getViewport().setViewPosition(p);
00068
00069
00070 getContentPane().add(editorScrollPane);
00071 editorScrollPane.setPreferredSize(new Dimension(450, 300));
00072 editorScrollPane.setMinimumSize(new Dimension(100, 100));
00073 editorScrollPane.setSize(new Dimension(450, 300));
00074 pack();
00075 setResizable(true);
00076 }
00077 public void open() {
00078 setVisible(true);
00079 }
00080
00081
00082 public void hyperlinkUpdate(HyperlinkEvent e) {
00083 if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
00084 try {
00085 BareBonesBrowserLaunch.openURL("http://www.gecode.org");
00086 } catch (Exception t) {}
00087 }
00088 }
00089
00090 }