本文整理汇总了Java中javax.help.JHelp类的典型用法代码示例。如果您正苦于以下问题:Java JHelp类的具体用法?Java JHelp怎么用?Java JHelp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JHelp类属于javax.help包,在下文中一共展示了JHelp类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAndDisplayJHelp
import javax.help.JHelp; //导入依赖的package包/类
private JHelp createAndDisplayJHelp( HelpSet hs ) {
JHelp jh = createJHelp(hs);
if (jh == null) {
return null;
}
if (isModalExcludedSupported()) {
displayHelpInFrame(jh);
} else {
if (currentModalDialog() == null) {
Installer.log.fine("showing as non-dialog");
displayHelpInFrame(jh);
} else {
Installer.log.fine("showing as dialog");
displayHelpInDialog(jh);
}
}
return jh;
}
示例2: display
import javax.help.JHelp; //导入依赖的package包/类
public void display(Window parent) {
if (helpFrame == null) {
helpFrame = new JFrame();
helpFrame.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
HelpSet helpSet = new HelpSet(null, helpSetPath.getURL());
JHelp jhelp = new JHelp(helpSet);
helpFrame = new JFrame("Help - " + getApplicationName());
helpFrame.getContentPane().add(jhelp);
helpFrame.setIconImage(getApplicationImage());
helpFrame.pack();
}
catch (Exception e) {
e.printStackTrace();
}
helpFrame.getGlassPane().setCursor(Cursor.getDefaultCursor());
}
if (!helpFrame.isVisible()) {
WindowUtils.centerOnParent(helpFrame, parent);
helpFrame.setVisible(true);
}
if ((helpFrame.getExtendedState() & Frame.NORMAL) == 0) {
helpFrame.setExtendedState(Frame.NORMAL);
}
helpFrame.toFront();
}
示例3: displayHelpInDialog
import javax.help.JHelp; //导入依赖的package包/类
private void displayHelpInDialog(JHelp jh) {
Installer.log.fine("displayHelpInDialog");
if (jh == null) jh = lastJH;
if (jh == null) throw new IllegalStateException();
ensureDialogViewer();
Rectangle bounds = null;
if (frameViewer != null) {
Installer.log.fine("\thiding old frame viewer");
if (frameViewer.isVisible()) {
bounds = frameViewer.getBounds();
frameViewer.setVisible(false);
}
frameViewer.getContentPane().removeAll();
}
if (dialogViewer.getContentPane().getComponentCount() > 0 &&
dialogViewer.getContentPane().getComponent(0) != jh) {
Installer.log.fine("\tchanging content");
dialogViewer.getContentPane().removeAll();
}
if (dialogViewer.getContentPane().getComponentCount() == 0) {
Installer.log.fine("\tadding content");
dialogViewer.getContentPane().add(jh, BorderLayout.CENTER);
dialogViewer.setTitle(jh.getModel().getHelpSet().getTitle());
dialogViewer.pack();
}
if (bounds != null) {
Installer.log.fine("\tcopying bounds from frame viewer: " + bounds);
dialogViewer.setBounds(bounds);
}
rearrange(currentModalDialog(), dialogViewer);
if (dialogViewer.isVisible()) {
Installer.log.fine("\talready visible, just repainting");
dialogViewer.repaint();
} else {
dialogViewer.setVisible(true);
}
lastJH = jh;
}
示例4: showHelp
import javax.help.JHelp; //导入依赖的package包/类
/**
* Display help topic from QuickSearch
* @param url Help URL
*/
void showHelp( URL url ) {
JHelp jh = createAndDisplayJHelp(getMaster());
if (jh == null) {
return;
}
displayInJHelp(jh, null, url);
}
示例5: displayInJHelp
import javax.help.JHelp; //导入依赖的package包/类
/** Display something in a JHelp.
*Handles {@link #MASTER_ID}, as well as help IDs
*that were not found in any help set, various exceptions, etc.
* @param jh the help component
* @param helpID a help ID string to display, may be <CODE>null</CODE>
* @param url a URL to display, may be <CODE>null</CODE>; lower priority than the help ID
*/
private synchronized void displayInJHelp(JHelp jh, String helpID, URL url) {
if (jh == null) throw new NullPointerException();
if (jh.getModel() == null) throw new IllegalArgumentException();
Installer.log.fine("displayInJHelp: " + helpID + " " + url);
assert SwingUtilities.isEventDispatchThread() :
"Please, re-open Bug #168973"; // NOI18N
try {
if (helpID != null && ! helpID.equals(MASTER_ID)) {
HelpSet hs = jh.getModel().getHelpSet();
if (hs.getCombinedMap().isValidID(helpID, hs)) {
HelpSet helpsetForId = findHelpSetForID(helpID); // #234143
if (helpsetForId != getMaster()) {
ID id = ID.create(helpID, helpsetForId);
try {
jh.setCurrentID(id);
} catch (InvalidHelpSetContextException ex) {
jh.setCurrentID(helpID);
}
} else {
jh.setCurrentID(helpID);
}
} else {
warnBadID(helpID);
}
} else if (url != null) {
jh.setCurrentURL(url);
}
} catch (RuntimeException e) {
Installer.log.log(Level.WARNING, null, e);
}
}
示例6: createJHelp
import javax.help.JHelp; //导入依赖的package包/类
/** Create & return a JHelp with the supplied help set.
* In the case of the master help, will show the home page for
* the distinguished help set if there is exactly one such,
* or in the case of exactly one home page, will show that.
* Caches the result and the result may be a reused JHelp.
* @return the new JHelp
* @param hs the help set to show
*/
private JHelp createJHelp(HelpSet hs) {
if (hs == null) throw new NullPointerException();
JHelp jh;
synchronized (availableJHelps) {
Reference<JHelp> r = availableJHelps.get(hs);
if (r != null) {
jh = r.get();
if (jh != null) {
return jh;
}
}
}
String title = null; // for debugging purposes
try {
title = hs.getTitle();
assert SwingUtilities.isEventDispatchThread() :
"Please, re-open Bug #168973"; // NOI18N
jh = new JHelp(hs);
adjust(jh);
} catch (RuntimeException e) {
Installer.log.log(Level.WARNING, "While trying to display: " + title, e); // NOI18N
return null;
}
synchronized (availableJHelps) {
availableJHelps.put(hs, new SoftReference<JHelp>(jh));
}
try {
javax.help.Map.ID home = hs.getHomeID();
if (home != null) {
jh.setCurrentID(home);
}
} catch (Exception e) {
Installer.log.log(Level.WARNING, null, e);
}
return jh;
}
示例7: adjust
import javax.help.JHelp; //导入依赖的package包/类
private void adjust(JHelp jh) {
JEditorPane contentViewer = (JEditorPane) getContentViewer(jh);
if(contentViewer == null) {
// Issue #168849
Installer.log.severe(
"Unable to find a JavaHelp Content Viewer component."); // NOI18N
Installer.log.severe("JavaHelp loaded from: " +
getCodeLocation(jh.getClass())); // NOI18N
Installer.log.severe("Current thread: " +
Thread.currentThread().toString()); // NOI18N
return;
}
adjustFontSize(contentViewer);
HyperlinkEventProcessor.addTo(contentViewer); // Issue #57005
}
示例8: testGetContentViewer
import javax.help.JHelp; //导入依赖的package包/类
/**
* Test of getContentViewer method, of class JavaHelp.
*/
@Test
public void testGetContentViewer() {
System.out.println("JavaHelp.getContentViewer");
Component c = new JHelp();
JavaHelp instance = new JavaHelp();
Component expResult = null;
Component result = instance.getContentViewer(c);
assertNotNull("Seems the version of the JavaHelp is changed. " +
" Please, review the method " +
"org.netbeans.modules.javahelp.JavaHelp.getContentViewer(java.awt.Component)",
result);
}
示例9: Help
import javax.help.JHelp; //导入依赖的package包/类
public Help() {
try {
ClassLoader cl = Help.class.getClassLoader();
URL hsURL = this.getClass().getResource("mi.hs");
HelpSet hs = new HelpSet(cl, hsURL);
//URL url = HelpSet.findHelpSet(cl, "mi.hs");
helpViewer = new JHelp(hs);
helpViewer.setCurrentID("top");
} catch (Exception e) {
System.err.println("API Help Set not found");
}
this.getContentPane().add(helpViewer);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
示例10: displayHelpInFrame
import javax.help.JHelp; //导入依赖的package包/类
private void displayHelpInFrame(JHelp jh) {
Installer.log.fine("displayHelpInFrame");
if (jh == null) jh = lastJH;
if (jh == null) throw new IllegalStateException();
boolean newFrameViewer = (frameViewer == null);
ensureFrameViewer();
if (dialogViewer != null) {
Installer.log.fine("\tdisposing old dialog");
dialogViewer.setVisible(false);
dialogViewer.getContentPane().removeAll();
dialogViewer.dispose();
dialogViewer = null;
}
if (frameViewer.getContentPane().getComponentCount() > 0 &&
frameViewer.getContentPane().getComponent(0) != jh) {
Installer.log.fine("\treplacing content");
frameViewer.getContentPane().removeAll();
}
if (frameViewer.getContentPane().getComponentCount() == 0) {
Installer.log.fine("\tadding content");
frameViewer.getContentPane().add(jh, BorderLayout.CENTER);
frameViewer.setTitle(jh.getModel().getHelpSet().getTitle());
frameViewer.pack();
}
if (newFrameViewer) {
// #22445: only do this stuff once when frame is made.
// After that we need to remember the size and position.
Rectangle bounds = Utilities.getUsableScreenBounds();
Dimension frameSize = frameViewer.getSize();
// #108255: Increase size of Help window by 30%
frameSize.width = (int) (1.3 * frameSize.width);
frameSize.height = (int) (1.3 * frameSize.height);
frameViewer.setSize(frameSize);
// #11018: have mercy on little screens
if (frameSize.width > bounds.width) {
frameSize.width = bounds.width;
}
if (frameSize.height > bounds.height) {
frameSize.height = bounds.height;
}
if ((frameSize.width > bounds.width) || (frameSize.height > bounds.height)) {
frameViewer.setSize(frameSize);
}
//Put frame to top right
frameViewer.setLocation(new Point(bounds.x + bounds.width - frameViewer.getSize().width, bounds.y));
}
frameViewer.setState(Frame.NORMAL);
if (frameViewer.isVisible()) {
frameViewer.repaint();
frameViewer.toFront(); // #20048
Installer.log.fine("\talready visible, just repainting");
} else {
bindFrameViewerToCurrentDialog();
frameViewer.setVisible(true);
}
//#29417: This call of requestFocus causes lost focus when Help window
//is reopened => removed.
//frameViewer.requestFocus();
lastJH = jh;
}
示例11: eventDispatched
import javax.help.JHelp; //导入依赖的package包/类
@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
}