本文整理了Java中net.sf.taverna.t2.workbench.helper.Helper.setKeyCatcher()
方法的一些代码示例,展示了Helper.setKeyCatcher()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.setKeyCatcher()
方法的具体详情如下:
包路径:net.sf.taverna.t2.workbench.helper.Helper
类名称:Helper
方法名:setKeyCatcher
[英]Associated the specified acion with key presses in the specified compoent.
[中]将指定的acion与指定组件中的按键关联。
代码示例来源:origin: net.sf.taverna.t2.workbench/helper
/**
* Set up a key-press catcher for the specified component such that when F1
* is pressed it should help for the component where the cursor is.
*
* @param rootpanecontainer
*/
public static void setKeyCatcher(final RootPaneContainer rootpanecontainer) {
AbstractAction theAction = new AbstractAction() {
public void actionPerformed(ActionEvent arg0) {
Component component = (Component) rootpanecontainer;
Container container = (Container) rootpanecontainer;
logger.info("frame action F1 pressed with source "
+ arg0.getSource().getClass().getName());
Point mousePosition = MouseInfo.getPointerInfo().getLocation();
Point framePosition = component.getLocation();
Point relativePosition = (Point) mousePosition.clone();
relativePosition.translate(-framePosition.x, -framePosition.y);
Component c = container.findComponentAt(relativePosition);
if (c != null) {
logger.info("F1 pressed in a " + c.getClass().getName());
}
showHelpWithinContainer(rootpanecontainer, c);
}
};
JRootPane pane = rootpanecontainer.getRootPane();
setKeyCatcher(pane, theAction);
}
代码示例来源:origin: net.sf.taverna.t2.ui-api/helper-api
/**
* Set up a key-press catcher for the specified component such that when F1
* is pressed it should help for the component where the cursor is.
*
* @param rootpanecontainer
*/
public static void setKeyCatcher(final RootPaneContainer rootpanecontainer) {
AbstractAction theAction = new AbstractAction() {
public void actionPerformed(ActionEvent arg0) {
Component component = (Component) rootpanecontainer;
Container container = (Container) rootpanecontainer;
logger.info("frame action F1 pressed with source "
+ arg0.getSource().getClass().getName());
Point mousePosition = MouseInfo.getPointerInfo().getLocation();
Point framePosition = component.getLocation();
Point relativePosition = (Point) mousePosition.clone();
relativePosition.translate(-framePosition.x, -framePosition.y);
Component c = container.findComponentAt(relativePosition);
if (c != null) {
logger.info("F1 pressed in a " + c.getClass().getName());
}
showHelpWithinContainer(rootpanecontainer, c);
}
};
JRootPane pane = rootpanecontainer.getRootPane();
setKeyCatcher(pane, theAction);
}
代码示例来源:origin: net.sf.taverna.t2.workbench/helper
/**
* Create a HelpEnabledDialog, register it (if possible) with the
* HelpCollator and attach a keycatcher.
*
* @param owner
* @param title
* @param modal
* @param id
* @throws HeadlessException
*/
public HelpEnabledDialog(Dialog owner, String title, boolean modal,
String id) throws HeadlessException {
super(owner, title, modal);
if (id != null) {
HelpCollator.registerComponent(this, id);
} else if (owner != null) {
HelpCollator.registerComponent(this, owner.getClass()
.getCanonicalName()
+ "-dialog");
}
Helper.setKeyCatcher(this);
}
代码示例来源:origin: net.sf.taverna.t2.ui-api/helper-api
/**
* Create a HelpEnabledDialog, register it (if possible) with the
* HelpCollator and attach a keycatcher.
*
* @param owner
* @param title
* @param modal
* @param id
* @throws HeadlessException
*/
public HelpEnabledDialog(Dialog owner, String title, boolean modal,
String id) throws HeadlessException {
super(owner, title, modal);
if (id != null) {
HelpCollator.registerComponent(this, id);
} else if (owner != null) {
HelpCollator.registerComponent(this, owner.getClass()
.getCanonicalName()
+ "-dialog");
}
Helper.setKeyCatcher(this);
}
代码示例来源:origin: net.sf.taverna.t2.workbench/helper
/**
* Create a HelpEnabledDialog, register it (if possible) with the
* HelpCollator and attach a keycatcher.
*
* @param owner
* @param title
* @param modal
* @param id
* @throws HeadlessException
*/
public HelpEnabledDialog(Frame owner, String title, boolean modal, String id)
throws HeadlessException {
super(owner, title, modal);
if (id != null) {
HelpCollator.registerComponent(this, id);
} else if (owner != null) {
HelpCollator.registerComponent(this, owner.getClass()
.getCanonicalName()
+ "-dialog");
} else if ((title != null) && !title.equals("")) {
HelpCollator.registerComponent(this, title);
}
Helper.setKeyCatcher(this);
}
代码示例来源:origin: net.sf.taverna.t2.ui-api/helper-api
/**
* Create a HelpEnabledDialog, register it (if possible) with the
* HelpCollator and attach a keycatcher.
*
* @param owner
* @param title
* @param modal
* @param id
* @throws HeadlessException
*/
public HelpEnabledDialog(Frame owner, String title, boolean modal, String id)
throws HeadlessException {
super(owner == null ? MainWindow.getMainWindow() : owner, title, modal);
if (id != null) {
HelpCollator.registerComponent(this, id);
} else if (owner != null) {
HelpCollator.registerComponent(this, owner.getClass()
.getCanonicalName()
+ "-dialog");
} else if ((title != null) && !title.equals("")) {
HelpCollator.registerComponent(this, title);
}
Helper.setKeyCatcher(this);
}
代码示例来源:origin: net.sf.taverna.t2.ui-impl/configuration-impl
private T2ConfigurationFrame () {
Helper.setKeyCatcher(this);
HelpCollator.registerComponent(this);
setLayout(new BorderLayout());
// Split pane to hold list of properties (on the left) and their configurable options (on the right)
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setBorder(new CompoundBorder(new EmptyBorder(10,10,10,10), new EtchedBorder()));
list = getConfigurationList();
JScrollPane jspList = new JScrollPane(list);
jspList.setBorder(new CompoundBorder(new BevelBorder(BevelBorder.LOWERED), new EmptyBorder(5,5,5,5)));
jspList.setMinimumSize(new Dimension(jspList.getPreferredSize().width, jspList.getPreferredSize().height));
splitPane.setLeftComponent(jspList);
splitPane.setRightComponent(new JPanel());
splitPane.setDividerSize(0);
//select first item if one exists
if (list.getModel().getSize()>0) {
list.setSelectedValue(list.getModel().getElementAt(0), true);
}
add(splitPane);
pack();
setSize(new Dimension(FRAME_WIDTH,FRAME_HEIGHT));
setVisible(true);
}
代码示例来源:origin: net.sf.taverna.t2.ui-impl/workbench-impl
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
Helper.setKeyCatcher(this);
内容来源于网络,如有侵权,请联系作者删除!