How can I display Help from a dialog box when the corresponding Help button is clicked?

Sandip Chitale

Add a JButton("Help") to the dialog. Add java.awt.event.ActionListener implementation to it using the button.addActionListener(...);. Then in the actionPerformed(...) callback you could show the help. The choices are -

  • Show the help in another java.awt.Frame. This may run into problems if your Dialog was "modal" (this is because the "modality" has been shifting it's meaning from version to version of Java).
  • Show it in another non-modal dialog
  • Run an external help program e.g.
    • WinHelp.exe
    • Browser
    Using the Runtime.exec("external command");