Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Oracle帮助java(ohj)_Java - Fatal编程技术网

Oracle帮助java(ohj)

Oracle帮助java(ohj),java,Java,我正在尝试Oracle的Java帮助。经过一整天,我有了html和文件配置,一切都很好。除了一件事 在修改了oracle给出的示例之后,我在我的项目中使用了这个类,并执行了它,工作正常 package es.unileon.happycow; import java.net.URL; import java.util.Vector; import oracle.help.Help; import oracle.help.library.Book; import oracle.help.lib

我正在尝试Oracle的Java帮助。经过一整天,我有了html和文件配置,一切都很好。除了一件事

在修改了oracle给出的示例之后,我在我的项目中使用了这个类,并执行了它,工作正常

package es.unileon.happycow;

import java.net.URL;
import java.util.Vector;

import oracle.help.Help;
import oracle.help.library.Book;
import oracle.help.library.helpset.HelpSet;

class HelpSystem2 {

    private static HelpSystem2 instance = null;

    private oracle.help.Help _helpObject;

    private HelpSystem2() {
        int i;
        Vector books = new Vector();

        boolean combineBooks = false;
        boolean useLabelInfo = true;
        try {
            URL fileURL = Init.class.getResource("/help/ohguide.hs");

            HelpSet aHelpSet = new HelpSet(fileURL);

            if (aHelpSet != null) {
                books.addElement(aHelpSet);
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }

        setHelp(books, combineBooks, useLabelInfo);
    }

    public static HelpSystem2 getInstance() {
        if (instance == null) {
            instance = new HelpSystem2();
        }
        return instance;
    }

    private void setHelp(Vector books, boolean combineBooks, boolean useLabelInfo) {
        int i;

        Class htmlBrowserClass = null;

        try {
            htmlBrowserClass = Class.forName("oracle.help.htmlBrowser.ICEBrowser");
        } catch (Exception e) {
            htmlBrowserClass = null;
            System.err.println("Failed to load ICEBrowser");
        }
        _helpObject = new Help(htmlBrowserClass, combineBooks, useLabelInfo, true);

        if (books != null) {
            for (i = 0; i < books.size(); i++) {
                Book aBook = (Book) books.elementAt(i);
                _helpObject.addBook(aBook);
            }
        }
    }

    public void start() {
        _helpObject.showNavigatorWindow();
    }
}

public class ChoiceDemo {

    public static void main(String[] args) {
        HelpSystem2.getInstance().start();
    }

}
但是现在不工作了,窗口出现了,带有帮助索引,但是html没有显示,只有空窗口

有什么区别

差速器的输出:

--- ChoiceDemo.java 2015-10-12 20:24:07.266411632 +0200
+++ HelpSystem.java 2015-10-12 20:25:54.469741168 +0200
@@ -8,13 +8,13 @@
 import oracle.help.library.Book;
 import oracle.help.library.helpset.HelpSet;

-class HelpSystem2 {
+public class HelpSystem {

-    private static HelpSystem2 instance = null;
+    private static HelpSystem instance = null;

     private oracle.help.Help _helpObject;

-    private HelpSystem2() {
+    private HelpSystem() {
     int i;
     Vector books = new Vector();

@@ -35,9 +35,9 @@
     setHelp(books, combineBooks, useLabelInfo);
     }

-    public static HelpSystem2 getInstance() {
+    public static HelpSystem getInstance() {
     if (instance == null) {
-            instance = new HelpSystem2();
+            instance = new HelpSystem();
     }
     return instance;
     }
@@ -66,12 +66,4 @@
     public void start() {
     _helpObject.showNavigatorWindow();
     }
-}
-
-public class ChoiceDemo {
-
-    public static void main(String[] args) {
-        HelpSystem2.getInstance().start();
-    }
-
-}
+}
\ No newline at end of file
以及我的项目结构。两者的帮助文件保持不变,第一个代码是ChoiceDemo.java,第二个代码是HelpSystem。在第二段代码中,应用程序的流程是Init实例化JFrame,JFrame实例化JFrameController,其中包含HelpSystem.getInstance.start;在他的构造器中


问题在于外观和感觉

我用了灵光主题

try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }

    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
        System.out.println("Error con el Look and feel");
    }
ohj不能显示html。对此,使用ohj提供的默认或设置oracle主题,代码可以在我调用它的任何地方工作


我的下一个问题是寻找一个新的主题,那些太难看了。。。u、 请提供更多信息,我不知道有什么区别。您可以尝试使用git来区分两种文件夹结构?我尝试使用HelpSystem而不是HelpSystem2 HelpSystem.getInstance.start;在ChoiceDemo.java中,仍然有效。在Init.java的静态main方法中调用它不起作用。相同的代码,相同的函数调用,不同的站点。没道理!
try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }

    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
        System.out.println("Error con el Look and feel");
    }