#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    7
    Rep Power
    0

    Exclamation How can i trigger HelpKey F1 from the tree menu (Run Application through Eclipse)


    Hi,

    I really need help and ideas on how can i trigger the helpKey F1 (JavaHelp) from selected tree menu from run application through eclipse?
    From the given document i read on JavaHelp, it works on field-level, such as textField (since this is component).

    My problem is i try to activate the HelpKey F1 from the tree menu. since this one is not component.

    I really appreciate for the help and ideas across from you guys!

    Thanks

    Regards,
    Aznimah
  2. #2
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,713
    Rep Power
    348
    I think the Robot class can "press" a key.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    7
    Rep Power
    0

    Hi


    Originally Posted by NormR
    I think the Robot class can "press" a key.
    Hi,

    Thanks for the reply.

    JavaHelp context-sensitive help offers, window-level, field-level (as in passing the component).

    But i need to activate the JavaHelp when user press the HelpKey F1 or JavaHelp button from the tree node (the application built-in : Eclipse). Since the tree node is not a component, so it cannot directly call the enableHelpKey or enableHelpOnButton. Furthermore, i need to open the selected JavaHelp content based on selected tree node (example there 3 node courseware : Science, Math, English)

    Thanks.
  6. #4
  7. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,713
    Rep Power
    348
    Can you make a small, simple program that complies, executes and shows the problem?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    7
    Rep Power
    0
    Originally Posted by NormR
    Can you make a small, simple program that complies, executes and shows the problem?
    Hi,

    Thanks again for the reply
    My problem already fixed, but right now, i cannot point directly to the selected content.

    Inside my JavaHelp content, i used to have a main topic and sub topic, for example:

    1.0 Mathematics

    1.2.1 Algebra

    in map.jhm file. how can i try to link direct to 1.2.1 Algebra?

    example link in my map.jhm

    <mapID target="MATHS" url="MATH/MATHEMATICS.html#1.2.1. ALGEBRA" />

    but cannot directly point to the MATHEMATICS.html#1.2.1. ALGEBRA. it go straight to MATHEMATICS.html

    really appreciate help on this

    Thanks
  10. #6
  11. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,713
    Rep Power
    348
    Can you post the java code you are having problems with?
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    7
    Rep Power
    0

    Exclamation


    Originally Posted by NormR
    Can you post the java code you are having problems with?
    Hi, back again to trigger F1 key action. Right now i test to trigger F1 key action after user click on JButton.

    I already check out like KeyBindings, mostly tutorial works for pressed key than trigger the button action example Enter key, or space key than trigger the Button action. But right now, my intention is vice versa, I want to click JButton than trigger the F1 key action.

    I try the KeyBindings but having a problem on how to set code to trigger the F1 key action

    here is some part of the code:

    action button:

    Code:
    final String helpIconLocation = new String("/icons/help_new.png");
    iconResource = CustomizedToolbar.class.getResource(helpIconLocation);
    icon = new ImageIcon(iconResource);
    actionButton = new JButton(icon);
    actionButton.setFocusable(false);
    actionButton.addActionListener(new JavaHelpHandler());
    actionListener:

    Code:
    private class JavaHelpHandler implements ActionListener {
    
            @Override
            public void actionPerformed(ActionEvent arg0) {
    
                Action javaHelpF1KeyAction = new AbstractAction();
                KeyStroke helpKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0);
                MainApp.getMainAppPanel().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
                        helpKeyStroke, "F1");
                MainApp.getMainAppPanel().getActionMap().put("F1", javaHelpF1KeyAction);
    
            }
    
        }
    
    
        private class AbstractAction implements ActionListener, Action {
    
            @Override
            public void actionPerformed(ActionEvent e) {
                // TO display popup javaHelp content
                HelpSystemUtil.getInstance().enableHelpFromFocus(actionButton);
            }
    
            @Override
            public void addPropertyChangeListener(PropertyChangeListener listener) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public Object getValue(String key) {
                // TODO Auto-generated method stub
                return null;
            }
    
            @Override
            public boolean isEnabled() {
                // TODO Auto-generated method stub
                return false;
            }
    
            @Override
            public void putValue(String key, Object value) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void removePropertyChangeListener(PropertyChangeListener listener) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void setEnabled(boolean b) {
                // TODO Auto-generated method stub
    
            }
    
        }
    really need help on this how to set code to trigger the F1 keys action when i click on action button

    Thanks
  14. #8
  15. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,713
    Rep Power
    348
    Can you post a small, simple program that compiles, executes and shows the problem?
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    7
    Rep Power
    0

    Smile


    Originally Posted by NormR
    Can you post a small, simple program that compiles, executes and shows the problem?
    Hi, thanks again for quick reply. Previously you already mentioned about Robot class. The problem already solved by implement that class

  18. #10
  19. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,713
    Rep Power
    348
    Glad you have gotten a solution.

IMN logo majestic logo threadwatch logo seochat tools logo