use of javax.help.WindowPresentation in project keystore-explorer by kaikramer.
the class HelpAction method createAndDisplayHelp.
private void createAndDisplayHelp() throws HelpSetException {
URL hsUrl = getClass().getResource(res.getString("HelpAction.HelpSet"));
HelpSet hs = new HelpSet(getClass().getClassLoader(), hsUrl);
if (LnfUtil.isDarculaAvailable()) {
URL hsDarculaUrl = getClass().getResource(res.getString("HelpAction.DarculaHelpSet"));
HelpSet hsDarcula = new HelpSet(getClass().getClassLoader(), hsDarculaUrl);
hs.add(hsDarcula);
}
helpBroker = new DefaultHelpBroker(hs);
WindowPresentation windowPresentation = helpBroker.getWindowPresentation();
windowPresentation.createHelpWindow();
// Make window immune to modal dialogs in application
Window helpWindow = windowPresentation.getHelpWindow();
helpWindow.setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
// Set help icons - set lots of different sizes to give each OS the most
// flexibility in choosing an icon for display
ArrayList<Image> icons = new ArrayList<Image>();
icons.add(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("HelpAction.image.16x16"))));
icons.add(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("HelpAction.image.24x24"))));
icons.add(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("HelpAction.image.32x32"))));
helpWindow.setIconImages(icons);
helpBroker.setLocation(new Point(frame.getX() + 25, frame.getY() + 25));
helpBroker.setSize(new Dimension(850, 600));
helpBroker.setCurrentID(START_ID);
helpBroker.setDisplayed(true);
}
use of javax.help.WindowPresentation in project bundle-app-ui by astrapi69.
the class DesktopMenu method newHelpMenu.
/**
* Factory method for create new {@link JMenu} for the help menu.
*
* @param listener
* the listener
* @return the j menu
*/
private JMenu newHelpMenu(final ActionListener listener) {
// Help menu
// $NON-NLS-1$
final JMenu menuHelp = new JMenu("Help");
menuHelp.setMnemonic('H');
// Help JMenuItems
// Help content
// $NON-NLS-1$
final JMenuItem mihHelpContent = new JMenuItem("Content", 'c');
MenuExtensions.setCtrlAccelerator(mihHelpContent, 'H');
menuHelp.add(mihHelpContent);
// found bug with the javax.help
// Exception in thread "main" java.lang.SecurityException: no manifiest
// section for signature file entry
// com/sun/java/help/impl/TagProperties.class
// Solution is to remove the rsa files from the jar
final HelpSet hs = getHelpSet();
final DefaultHelpBroker helpBroker = (DefaultHelpBroker) hs.createHelpBroker();
final WindowPresentation pres = helpBroker.getWindowPresentation();
pres.createHelpWindow();
helpWindow = pres.getHelpWindow();
helpWindow.setLocationRelativeTo(null);
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (final Exception e1) {
log.error(e1.getLocalizedMessage(), e1);
}
SwingUtilities.updateComponentTreeUI(helpWindow);
// 2. assign help to components
CSH.setHelpIDString(mihHelpContent, "Overview");
// 3. handle events
final CSH.DisplayHelpFromSource displayHelpFromSource = new CSH.DisplayHelpFromSource(helpBroker);
mihHelpContent.addActionListener(displayHelpFromSource);
mihHelpContent.addActionListener(new ShowHelpDialogAction("Content"));
// Donate
final JMenuItem mihDonate = new JMenuItem(// $NON-NLS-1$
Messages.getString("com.find.duplicate.files.menu.item.donate"));
mihDonate.addActionListener(new OpenBrowserToDonateAction("Donate"));
menuHelp.add(mihDonate);
// Licence
// $NON-NLS-1$
final JMenuItem mihLicence = new JMenuItem("Licence");
mihLicence.addActionListener(new ShowLicenseFrameAction("Licence"));
menuHelp.add(mihLicence);
// Info
// $NON-NLS-1$
final JMenuItem mihInfo = new JMenuItem("Info", 'i');
MenuExtensions.setCtrlAccelerator(mihInfo, 'I');
mihInfo.addActionListener(new ShowInfoDialogAction("Info"));
menuHelp.add(mihInfo);
return menuHelp;
}
Aggregations