Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8924195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:20:40+00:00 2026-06-15T07:20:40+00:00

Right now i’m working on JavaHelp content. Basically, First solution, after you select the

  • 0

Right now i’m working on JavaHelp content.

Basically, First solution, after you select the the selected function from the tree menu or node (JTree), and pressed help key (F1) it will popup the specific JavaHelp content based on selected node.

Right now, im trying to add Help button, user first need to select function from the tree menu or node and click on Help button i created. it suppose work exactly as the first solution but right now, it doesn’t popup the correct content.

How can i make the Help button to trigger the F1 key action? meaning when we select the node, it already have a focus n can directly popup if we pressed F1 key, the help button would probably just trigger the F1 key action.

I heard about doClick function or keys binding, any ideas on this?

Thanks

Regards,
Aznimah

Hi, i try to implement the keybinding to trigger the F1 key action when user click on Help button. But i clueless how to set code to trigger the F1 key action. Here is some code :

action button:

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:

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

        }

    }

How can i set actionMap to trigger the F1 keys action? really need help on this

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:20:41+00:00Added an answer on June 15, 2026 at 7:20 am

    The best way you could do is to create a Key Listener.

    KeyListener

    There are several ways to do this. Here’s one:

    
        yourComponent.addKeyListener(new KeyAdapter () { 
             @Override
             public void keyPressed(KeyEvent e) {
    
                  if ( e == YOUR_KEY_CODE ) {
                       // Do something
                  }
    
             }
        });
    

    Anyway, key code for F1 is 112

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now, I've just some code which fetches the picture from the URL directly.
Right now I have a function, in a class that is used to listen
Right now I am only trying to get my getline() function to work. I
Right now I'm working on a Internet Explorer add on which is supposed to
right now I have a huge Solution in which we use javascript alerts via
Right now I detect the credit card type based upon the first four numbers
right now i have this <script type='text/javascript'> $(#beau).click(function(){ $(#beau).animate({margin-Top: 738px}, fast); }); </script> and
Right now I'm building a small app that imports data from a spreadsheet and
Right now I'm working on small project, submitting very simple jobs and I'm working
Right now, I'm particularly interested in reading the data from MP3 files (ID3 tags?),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.