Search in sources :

Example 1 with LFrame

use of com.cburch.logisim.gui.generic.LFrame in project logisim-evolution by reds-heig.

the class MenuHelp method loadBroker.

private void loadBroker() {
    String helpUrl = Strings.get("helpsetUrl");
    if (helpUrl == null) {
        helpUrl = "doc/doc_en.hs";
    }
    if (helpSet == null || helpFrame == null || !helpUrl.equals(helpSetUrl)) {
        ClassLoader loader = MenuHelp.class.getClassLoader();
        try {
            URL hsURL = HelpSet.findHelpSet(loader, helpUrl);
            if (hsURL == null) {
                disableHelp();
                JOptionPane.showMessageDialog(menubar.getParentWindow(), Strings.get("helpNotFoundError"));
                return;
            }
            helpSetUrl = helpUrl;
            helpSet = new HelpSet(null, hsURL);
            helpComponent = new JHelp(helpSet);
            if (helpFrame == null) {
                helpFrame = new LFrame();
                helpFrame.setTitle(Strings.get("helpWindowTitle"));
                helpFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
                helpFrame.getContentPane().add(helpComponent);
                helpFrame.setPreferredSize(new Dimension((int) Toolkit.getDefaultToolkit().getScreenSize().getWidth() >> 1, (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight() >> 1));
                helpFrame.pack();
            } else {
                helpFrame.getContentPane().removeAll();
                helpFrame.getContentPane().add(helpComponent);
                helpComponent.revalidate();
            }
        } catch (Exception e) {
            disableHelp();
            e.printStackTrace();
            JOptionPane.showMessageDialog(menubar.getParentWindow(), Strings.get("helpUnavailableError"));
            return;
        }
    }
}
Also used : HelpSet(javax.help.HelpSet) LFrame(com.cburch.logisim.gui.generic.LFrame) Dimension(java.awt.Dimension) URL(java.net.URL) JHelp(javax.help.JHelp)

Aggregations

LFrame (com.cburch.logisim.gui.generic.LFrame)1 Dimension (java.awt.Dimension)1 URL (java.net.URL)1 HelpSet (javax.help.HelpSet)1 JHelp (javax.help.JHelp)1