本文整理汇总了Java中javax.help.HelpSet.createHelpBroker方法的典型用法代码示例。如果您正苦于以下问题:Java HelpSet.createHelpBroker方法的具体用法?Java HelpSet.createHelpBroker怎么用?Java HelpSet.createHelpBroker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.help.HelpSet
的用法示例。
在下文中一共展示了HelpSet.createHelpBroker方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import javax.help.HelpSet; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
try {
String helpHS = "jhelpset.hs"; //$NON-NLS-1$
ClassLoader cl = getClass().getClassLoader();
URL hsURL = HelpSet.findHelpSet(cl, helpHS);
HelpSet hs = new HelpSet(null, hsURL);
HelpBroker hb = hs.createHelpBroker();
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
// Default HelpBroker size is too small, make bigger unless on anciente "VGA" resolution
if (d.width >= 1024 && d.height >= 800) {
hb.setSize(new Dimension(1024, 700));
} else {
hb.setSize(new Dimension(640, 480));
}
CSH.DisplayHelpFromSource helpDisplay = new CSH.DisplayHelpFromSource(hb);
helpDisplay.actionPerformed(e);
} catch (Exception ev) {
setEnabled(false);
SPSUtils.showExceptionDialogNoReport(parentFrame,
"Could not load help file",
ev);
}
}
示例2: startupMapHook
import javax.help.HelpSet; //导入方法依赖的package包/类
/**
*
*/
public void startupMapHook() {
super.startupMapHook();
// Find the HelpSet file and create the HelpSet object:
String helpHS = "plugins/help/doc/freemind.hs";
try {
ClassLoader classLoader = this.getClass().getClassLoader();
URL hsURL = HelpSet.findHelpSet(classLoader, helpHS);
HelpSet hs = new HelpSet(classLoader, hsURL);
HelpBroker hb = hs.createHelpBroker();
hb.initPresentation();
hb.setDisplayed(true);
hb.setViewDisplayed(true);
} catch (Exception ee) {
// Say what the exception really is
freemind.main.Resources.getInstance().logException(ee);
logger.warning("HelpSet " + ee.getMessage() + ee);
logger.warning("HelpSet " + helpHS + " not found");
return;
}
}
示例3: initHelpSystem
import javax.help.HelpSet; //导入方法依赖的package包/类
/**
* Initialize the JavaHelp system.
*/
public static void initHelpSystem() {
// optimization to avoid repeated init
if (fHelp != null && fDisplayHelp != null)
return;
// (uses the classloader mechanism)
ClassLoader loader = IntroduceHelp.class.getClassLoader();
URL helpSetURL = HelpSet.findHelpSet(loader, "Introduce.hs");
try {
helpSet = new HelpSet(null, helpSetURL);
fHelp = helpSet.createHelpBroker();
fDisplayHelp = new CSH.DisplayHelpFromSource(fHelp);
} catch (HelpSetException ex) {
logger.warn("Cannot create help system with: " + helpSetURL + " " + ex.getMessage());
}
}
示例4: actionPerformed
import javax.help.HelpSet; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
try {
String helpHS = "jhelpset.hs";
ClassLoader cl = getClass().getClassLoader();
URL hsURL = HelpSet.findHelpSet(cl, helpHS);
HelpSet hs = new HelpSet(null, hsURL);
HelpBroker hb = hs.createHelpBroker();
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
// Default HelpBroker size is too small, make bigger unless on anciente "VGA" resolution
if (d.width >= 1024 && d.height >= 800) {
hb.setSize(new Dimension(1024, 700));
} else {
hb.setSize(new Dimension(640, 480));
}
CSH.DisplayHelpFromSource helpDisplay = new CSH.DisplayHelpFromSource(hb);
helpDisplay.actionPerformed(e);
} catch (Exception ev) {
setEnabled(false);
SPSUtils.showExceptionDialogNoReport(parent,
"Could not load the help file. The dqguruhelp.jar file either " +
"doesn't exist or isn't in your classpath.\nThis error usually " +
"occurrs because you are running the DQguru within an IDE.\n" +
"The Help function is now disabled",
ev);
}
}
示例5: TrajStatHelp
import javax.help.HelpSet; //导入方法依赖的package包/类
public TrajStatHelp() {
f = new JFrame("Menu Example");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuBar mbar = new JMenuBar();
// a file menu
JMenu file = new JMenu("File");
JMenu help = new JMenu("Help");
// add an item to the help menu
help.add(topics = new JMenuItem("Help Topics"));
// add the menu items to the menu bar
mbar.add(file);
mbar.add(help);
// 1. create HelpSet and HelpBroker objects
HelpSet hs = getHelpSet("mi.hs");
HelpBroker hb = hs.createHelpBroker();
// 2. assign help to components
CSH.setHelpIDString(topics, "top");
// 3. handle events
topics.addActionListener(new CSH.DisplayHelpFromSource(hb));
// attach menubar to frame, set its size, and make it visible
f.setJMenuBar(mbar);
f.setSize(500, 300);
f.setVisible(true);
}
示例6: isAvailable
import javax.help.HelpSet; //导入方法依赖的package包/类
/**
* Tell if help set can be used
*
* @return true if the help set can be used, false otherwise.
*/
public static boolean isAvailable() {
if (_instance == null) {
_instance = new HelpView();
}
if (!_alreadyInitialized) {
final ClassLoader appClassLoader = _instance.getClass().getClassLoader();
URL url = null;
try {
// Get the helpset file and create the centered help broker
url = HelpSet.findHelpSet(appClassLoader, "documentation.hs");
_logger.debug("HelpSet.findHelpSet(appClassLoader, 'documentation.hs') = '{}'.", url);
// http://forums.sun.com/thread.jspa?messageID=10522645
url = UrlUtils.fixJarURL(url);
_logger.debug("using helpset url = '{}'.", url);
// check if the url is valid :
if (url == null) {
_logger.info("No helpset document found.");
return false;
}
final HelpSet helpSet = new HelpSet(appClassLoader, url);
_helpBroker = helpSet.createHelpBroker();
} catch (Exception e) {
// skip complex case
_logger.error("Problem during helpset creation (url='{}', classloader={})",
url, appClassLoader, e);
}
_alreadyInitialized = true;
}
return (_helpBroker != null);
}