use of javax.help.JHelp 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;
}
}
}
use of javax.help.JHelp in project ffx by mjschnie.
the class MainPanel method help.
/**
* <p>
* help</p>
*/
public void help() {
String helpHS = "ffx/help/jhelpset.hs";
ClassLoader cl = getClass().getClassLoader();
HelpSet hs = null;
try {
URL hsURL = HelpSet.findHelpSet(cl, helpHS);
hs = new HelpSet(null, hsURL);
} catch (Exception e) {
logger.warning("HelpSet not found: " + e);
return;
}
JHelp jhelp = new JHelp(hs);
JFrame helpFrame = new JFrame();
JFrame.setDefaultLookAndFeelDecorated(true);
helpFrame.add(jhelp);
helpFrame.setTitle("Force Field X Help");
helpFrame.setSize(jhelp.getPreferredSize());
helpFrame.setVisible(true);
jhelp.setCurrentID("ForceFieldXBook");
helpFrame.toFront();
}
use of javax.help.JHelp in project logisim-evolution by reds-heig.
the class Startup method eventDispatched.
@Override
public void eventDispatched(AWTEvent event) {
if (event instanceof ContainerEvent) {
ContainerEvent containerEvent = (ContainerEvent) event;
if (containerEvent.getID() == ContainerEvent.COMPONENT_ADDED) {
Component container = containerEvent.getChild();
if ((container instanceof JButton) || (container instanceof JCheckBox) || (container instanceof JComboBox) || (container instanceof JLabel) || (container instanceof JMenu) || (container instanceof JMenuItem) || (container instanceof JRadioButton) || (container instanceof JRadioButtonMenuItem) || (container instanceof JSpinner) || (container instanceof JTabbedPane) || (container instanceof JTextField) || (container instanceof JHelp) || (container instanceof JFileChooser) || ((container instanceof JScrollPane) && (!(container instanceof CanvasPane))) || (container instanceof JFontChooser) || (container instanceof JCheckBoxMenuItem)) {
AppPreferences.setScaledFonts(((JComponent) container).getComponents());
try {
container.setFont(AppPreferences.getScaledFont(containerEvent.getChild().getFont()));
container.revalidate();
container.repaint();
} catch (Exception e) {
}
}
if (container instanceof JOptionPane) {
JOptionPane pane = (JOptionPane) container;
if (HasIcon(pane)) {
ImageIcon icon;
switch(pane.getMessageType()) {
case JOptionPane.ERROR_MESSAGE:
icon = new ImageIcon(getClass().getClassLoader().getResource("resources/logisim/error.png"));
pane.setIcon(AppPreferences.getScaledImageIcon(icon, (float) 3));
break;
case JOptionPane.QUESTION_MESSAGE:
icon = new ImageIcon(getClass().getClassLoader().getResource("resources/logisim/question.png"));
pane.setIcon(AppPreferences.getScaledImageIcon(icon, (float) 3));
break;
case JOptionPane.PLAIN_MESSAGE:
icon = new ImageIcon(getClass().getClassLoader().getResource("resources/logisim/plain.png"));
pane.setIcon(AppPreferences.getScaledImageIcon(icon, (float) 3));
break;
case JOptionPane.INFORMATION_MESSAGE:
icon = new ImageIcon(getClass().getClassLoader().getResource("resources/logisim/info.png"));
pane.setIcon(AppPreferences.getScaledImageIcon(icon, (float) 3));
break;
case JOptionPane.WARNING_MESSAGE:
icon = new ImageIcon(getClass().getClassLoader().getResource("resources/logisim/warning.png"));
pane.setIcon(AppPreferences.getScaledImageIcon(icon, (float) 3));
break;
}
}
}
}
}
// TODO Auto-generated method stub
}
Aggregations