msg.addAction(new PrintAction()); msg.addAction(new ForwardAction());
public void actionPerformed(ActionEvent evt){ timer.stop(); if (ForwardAction.this.isEnabled()) { ForwardAction.this.showForwardHistory(e); } } }
/** * Tells the listener that the history has changed. * Will enable/disable the Action depending on the events previous flag * * @param e The HelpHistoryModelEvent */ public void historyChanged(HelpHistoryModelEvent e) { setEnabled(e.isNext()); }
/** Creates new ForwardAction */ public ForwardAction(Object control) { super(control, NAME); if (control instanceof JHelp) { JHelp help = (JHelp)control; historyModel = help.getHistoryModel(); historyModel.addHelpHistoryModelListener(this); setEnabled(historyModel.getIndex() > 0); putValue("icon", UIManager.getIcon(NAME + ".icon")); Locale locale = null; try { locale = help.getModel().getHelpSet().getLocale(); } catch (NullPointerException npe) { locale = Locale.getDefault(); } putValue("tooltip", HelpUtilities.getString(locale, "tooltip." + NAME)); putValue("access", HelpUtilities.getString(locale, "access." + NAME)); } }
Locale locale = ((JHelp)getControl()).getModel().getHelpSet().getLocale(); Enumeration items = historyModel.getForwardHistory().elements(); JMenuItem mi = null;
private Enumeration createDefaultActions() { Vector actions = new Vector(5); actions.add(new BackAction(help)); actions.add(new ForwardAction(help)); actions.add(new SeparatorAction(help)); actions.add(new PrintAction(help)); actions.add(new PrintSetupAction(help)); actions.add(new SeparatorAction(help)); if (favorites != null) { actions.add(new FavoritesAction(help)); } return actions.elements(); }
/** * Invoked when the mouse has been clicked on a component. */ public void mouseClicked(MouseEvent e) { if ((historyModel != null) && isEnabled()) { historyModel.goForward(); } }