Creating 'help' windows from dialog button

Using MS Vis J++, I've created some dialog windows to get user input.  I added 'help' buttons to the dialog windows, but can't figure out how to display help messages without destroying the dialog window.  The way I've tried is to create new dialog boxes with the help messages in them--and these are called from the action method of the original dialog.  The problem is, I can't return to that dialog, and the program hangs after reading the help dialog.  This is part of a big program, so here's a portion of the applet code.  If there is a way to allow returning to the dialog box, or an easier way to do this, please let me know:

//the dialog frame that calls the help frame
class OurFrame extends Frame
{
      private AutoDialog m_autodialog = null;
      private Applet m_parent = null;      
      public DialogData m_data = null;
      private HelpFrame m_frame3 = null;

      public OurFrame(Applet parent)
      {
            super("Input Window #1");
            m_parent = parent;
            setFont(new Font("Arial", Font.PLAIN, 12));

            m_autodialog = new AutoDialog(this);
            m_autodialog.CreateControls();
            show();
      }
      public boolean action(Event event, Object obj)
      {
            Object target = event.target;
            if (target instanceof Button)
            {
                  Button button = (Button)target;
                  String buttonLabel = button.getLabel();
                  
                  if (buttonLabel.compareTo("Help") == 0)
                  {
                        m_frame3 =new HelpFrame();
                        //m_help1 = new help1(this);
                        //m_help1.CreateControls();
                        //hide();
                        m_parent.repaint();
                        
                  }
                  if (buttonLabel.compareTo("OK")== 0)
                  {
                        String sk = m_autodialog.IDC_EDIT2.getText();
                        boolean a1 = m_autodialog.IDC_RADIO1.getState();//false = .05
            
                        int m_k = Integer.parseInt(sk);            
                        m_data = new DialogData(sk,a1);
                        m_parent.repaint();
                  }
                  hide();
                  return true;
            }
            return false;
      }


//The helpFrame class that the above calls when the help button is clicked:
class HelpFrame extends Frame
{
      private help1 m_help1 = null;
      public HelpFrame()
      {
            super("Help");
            setFont(new Font("Arial", Font.PLAIN, 12));

            m_help1 = new help1(this);
            m_help1.CreateControls();
            show();
      }
      public boolean action(Event event, Object obj)
      {
            Object target = event.target;
            if (target instanceof Button)
            {
                  Button button = (Button)target;
                  String buttonLabel = button.getLabel();
                  if (buttonLabel.compareTo("OK")== 0)
                  {
                        //m_parent3.repaint();
                        repaint();                        
                  }
                              
                  hide();
                  return true;
            }
            return false;
      }
}
imsapAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gadioCommented:
  You haven't said if its an applet or an application. If its an applet, a good idea will be to use the showDocument method to open a new brawser window hith your help, and to write your help in html. This is probably the easiest way of creating a help system.
0
gadioCommented:
 I see now by your code that it is an applet, so let me know if this direction is good for you, I'll give you some more info about it.
0
imsapAuthor Commented:
Thanks for the reply.  Actually, I have both an application and applet version.  I also figured out the problem--I left off a "return false" in the call to the help dialogs from the original dialogs.  However, you can have the points if you put in some info about using the ShowDocument to create a new browser page.  This would be helpful for cleaning up my applet output.
0
gadioCommented:
 I will give you a sample code:
Say that you want to give a help on an item, and you have a
-----
file: simpleApplet1.java
-----


import java.applet.*;
import java.awt.*;

public class simpleApplet1 extends Applet {
  TextField text;
  Button b;
  String help_item;

  public simpleApplet1() {
        help_item = new String( "help" );
        text = new TextField(20);
        b = new Button("help_me");
        add( b );
        add( text );
  }

  public boolean handleEvent( Event evt ) {
        if( evt.target == b ) {
          try {
                getAppletContext().showDocument(new java.net.URL(getCodeBase(),help_item+".html"), help_item);
          }
          catch ( java.net.MalformedURLException e ){}
          return true;
        }
        return false;
  }

}


file index.html
----

<html>
<applet code=simpleApplet1.class name=app2 width=190 height=145>
</applet>
</html>


file: help.html
----

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  <head>
    <title>help file</title>
  </head>
  <body>
      <h1>help file</h1>
      <hr>
          This is a help about...
  </body>
</html>


---------
Apart from that I'd like to note that sun has a new API for help system. You can check it out at:
http://java.sun.com/products/javahelp/download_spec.html
This help system should fit both applet and application.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.