Java JFrame Show showHelp(JFrame frame, String path)

Here you can find the source of showHelp(JFrame frame, String path)

Description

show Help

License

Open Source License

Declaration

public static void showHelp(JFrame frame, String path) 

Method Source Code

//package com.java2s;
/*/*  w  w  w  . ja  va2 s. com*/
 * netTransformer is an open source tool able to discover and transform
 *  IP network infrastructures.
 *  Copyright (C) 2012  http://itransformers.net
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import javax.swing.*;
import java.io.File;
import java.net.URI;

public class Main {
    public static void showHelp(JFrame frame, String path) {
        File docRoot = new File(
                "iTopologyManager/topologyViewer/src/main/resources/helpdocs");
        File docFile = new File(docRoot, path);
        URI docURI = docFile.toURI();
        if (!java.awt.Desktop.isDesktopSupported()) {
            JOptionPane.showConfirmDialog(frame,
                    "Can not open default browser. See the documentation in: "
                            + docURI);
        }

        java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
        if (!desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
            JOptionPane.showConfirmDialog(frame,
                    "Can not open default browser. See the documentation in: "
                            + docURI);
        }

        try {
            desktop.browse(docURI);
        } catch (Exception e) {
            JOptionPane.showConfirmDialog(frame,
                    "Can not open default browser. See the documentation in: "
                            + docURI);
        }
    }
}

Related

  1. show(JFrame frame)
  2. showAndSaveReportFile(JFrame frmParent, File defaultReportFile, String data)
  3. showDemoFrame(JFrame frame)
  4. showFrame(JFrame frame)
  5. showFrame(JFrame frame, JFrame parent)
  6. showModalFrame(final JFrame newFrame, final JFrame owner)
  7. showOnScreen(int screen, JFrame frame)
  8. showSaveDialog(JFrame parent, String message)
  9. showSuccess(JFrame frame)