net.sf.taverna.t2.workbench.helper.Helper.setKeyCatcher()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(131)

本文整理了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

Helper.setKeyCatcher介绍

[英]Associated the specified acion with key presses in the specified compoent.
[中]将指定的acion与指定组件中的按键关联。

代码示例

代码示例来源:origin: net.sf.taverna.t2.workbench/helper

  1. /**
  2. * Set up a key-press catcher for the specified component such that when F1
  3. * is pressed it should help for the component where the cursor is.
  4. *
  5. * @param rootpanecontainer
  6. */
  7. public static void setKeyCatcher(final RootPaneContainer rootpanecontainer) {
  8. AbstractAction theAction = new AbstractAction() {
  9. public void actionPerformed(ActionEvent arg0) {
  10. Component component = (Component) rootpanecontainer;
  11. Container container = (Container) rootpanecontainer;
  12. logger.info("frame action F1 pressed with source "
  13. + arg0.getSource().getClass().getName());
  14. Point mousePosition = MouseInfo.getPointerInfo().getLocation();
  15. Point framePosition = component.getLocation();
  16. Point relativePosition = (Point) mousePosition.clone();
  17. relativePosition.translate(-framePosition.x, -framePosition.y);
  18. Component c = container.findComponentAt(relativePosition);
  19. if (c != null) {
  20. logger.info("F1 pressed in a " + c.getClass().getName());
  21. }
  22. showHelpWithinContainer(rootpanecontainer, c);
  23. }
  24. };
  25. JRootPane pane = rootpanecontainer.getRootPane();
  26. setKeyCatcher(pane, theAction);
  27. }

代码示例来源:origin: net.sf.taverna.t2.ui-api/helper-api

  1. /**
  2. * Set up a key-press catcher for the specified component such that when F1
  3. * is pressed it should help for the component where the cursor is.
  4. *
  5. * @param rootpanecontainer
  6. */
  7. public static void setKeyCatcher(final RootPaneContainer rootpanecontainer) {
  8. AbstractAction theAction = new AbstractAction() {
  9. public void actionPerformed(ActionEvent arg0) {
  10. Component component = (Component) rootpanecontainer;
  11. Container container = (Container) rootpanecontainer;
  12. logger.info("frame action F1 pressed with source "
  13. + arg0.getSource().getClass().getName());
  14. Point mousePosition = MouseInfo.getPointerInfo().getLocation();
  15. Point framePosition = component.getLocation();
  16. Point relativePosition = (Point) mousePosition.clone();
  17. relativePosition.translate(-framePosition.x, -framePosition.y);
  18. Component c = container.findComponentAt(relativePosition);
  19. if (c != null) {
  20. logger.info("F1 pressed in a " + c.getClass().getName());
  21. }
  22. showHelpWithinContainer(rootpanecontainer, c);
  23. }
  24. };
  25. JRootPane pane = rootpanecontainer.getRootPane();
  26. setKeyCatcher(pane, theAction);
  27. }

代码示例来源:origin: net.sf.taverna.t2.workbench/helper

  1. /**
  2. * Create a HelpEnabledDialog, register it (if possible) with the
  3. * HelpCollator and attach a keycatcher.
  4. *
  5. * @param owner
  6. * @param title
  7. * @param modal
  8. * @param id
  9. * @throws HeadlessException
  10. */
  11. public HelpEnabledDialog(Dialog owner, String title, boolean modal,
  12. String id) throws HeadlessException {
  13. super(owner, title, modal);
  14. if (id != null) {
  15. HelpCollator.registerComponent(this, id);
  16. } else if (owner != null) {
  17. HelpCollator.registerComponent(this, owner.getClass()
  18. .getCanonicalName()
  19. + "-dialog");
  20. }
  21. Helper.setKeyCatcher(this);
  22. }

代码示例来源:origin: net.sf.taverna.t2.ui-api/helper-api

  1. /**
  2. * Create a HelpEnabledDialog, register it (if possible) with the
  3. * HelpCollator and attach a keycatcher.
  4. *
  5. * @param owner
  6. * @param title
  7. * @param modal
  8. * @param id
  9. * @throws HeadlessException
  10. */
  11. public HelpEnabledDialog(Dialog owner, String title, boolean modal,
  12. String id) throws HeadlessException {
  13. super(owner, title, modal);
  14. if (id != null) {
  15. HelpCollator.registerComponent(this, id);
  16. } else if (owner != null) {
  17. HelpCollator.registerComponent(this, owner.getClass()
  18. .getCanonicalName()
  19. + "-dialog");
  20. }
  21. Helper.setKeyCatcher(this);
  22. }

代码示例来源:origin: net.sf.taverna.t2.workbench/helper

  1. /**
  2. * Create a HelpEnabledDialog, register it (if possible) with the
  3. * HelpCollator and attach a keycatcher.
  4. *
  5. * @param owner
  6. * @param title
  7. * @param modal
  8. * @param id
  9. * @throws HeadlessException
  10. */
  11. public HelpEnabledDialog(Frame owner, String title, boolean modal, String id)
  12. throws HeadlessException {
  13. super(owner, title, modal);
  14. if (id != null) {
  15. HelpCollator.registerComponent(this, id);
  16. } else if (owner != null) {
  17. HelpCollator.registerComponent(this, owner.getClass()
  18. .getCanonicalName()
  19. + "-dialog");
  20. } else if ((title != null) && !title.equals("")) {
  21. HelpCollator.registerComponent(this, title);
  22. }
  23. Helper.setKeyCatcher(this);
  24. }

代码示例来源:origin: net.sf.taverna.t2.ui-api/helper-api

  1. /**
  2. * Create a HelpEnabledDialog, register it (if possible) with the
  3. * HelpCollator and attach a keycatcher.
  4. *
  5. * @param owner
  6. * @param title
  7. * @param modal
  8. * @param id
  9. * @throws HeadlessException
  10. */
  11. public HelpEnabledDialog(Frame owner, String title, boolean modal, String id)
  12. throws HeadlessException {
  13. super(owner == null ? MainWindow.getMainWindow() : owner, title, modal);
  14. if (id != null) {
  15. HelpCollator.registerComponent(this, id);
  16. } else if (owner != null) {
  17. HelpCollator.registerComponent(this, owner.getClass()
  18. .getCanonicalName()
  19. + "-dialog");
  20. } else if ((title != null) && !title.equals("")) {
  21. HelpCollator.registerComponent(this, title);
  22. }
  23. Helper.setKeyCatcher(this);
  24. }

代码示例来源:origin: net.sf.taverna.t2.ui-impl/configuration-impl

  1. private T2ConfigurationFrame () {
  2. Helper.setKeyCatcher(this);
  3. HelpCollator.registerComponent(this);
  4. setLayout(new BorderLayout());
  5. // Split pane to hold list of properties (on the left) and their configurable options (on the right)
  6. splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  7. splitPane.setBorder(new CompoundBorder(new EmptyBorder(10,10,10,10), new EtchedBorder()));
  8. list = getConfigurationList();
  9. JScrollPane jspList = new JScrollPane(list);
  10. jspList.setBorder(new CompoundBorder(new BevelBorder(BevelBorder.LOWERED), new EmptyBorder(5,5,5,5)));
  11. jspList.setMinimumSize(new Dimension(jspList.getPreferredSize().width, jspList.getPreferredSize().height));
  12. splitPane.setLeftComponent(jspList);
  13. splitPane.setRightComponent(new JPanel());
  14. splitPane.setDividerSize(0);
  15. //select first item if one exists
  16. if (list.getModel().getSize()>0) {
  17. list.setSelectedValue(list.getModel().getElementAt(0), true);
  18. }
  19. add(splitPane);
  20. pack();
  21. setSize(new Dimension(FRAME_WIDTH,FRAME_HEIGHT));
  22. setVisible(true);
  23. }

代码示例来源:origin: net.sf.taverna.t2.ui-impl/workbench-impl

  1. setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  2. Helper.setKeyCatcher(this);

相关文章