Results 1 to 2 of 2
  1. #1
    helios_lie is offline Member
    Join Date
    Dec 2007
    Posts
    1
    Rep Power
    0

    Default JTable Focus Traversal

    Hi, may I know how can I disable focus traversal by ENTER key in jtable? I have a jtable with only one column, and everytime I pressed ENTER key, the focus will be transferred to the next row. May I know how can I disable this?
    Thank you.

  2. #2
    Arom_ART is offline Member
    Join Date
    Dec 2007
    Posts
    2
    Rep Power
    0

    Default

    JTable.getInputMap(JInternalFrame.WHEN_ANCESTOR_OF _FOCUSED_COMPONENT)
    .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "SOME_ACTION");
    JTable.getInputMap(JInternalFrame.WHEN_FOCUSED)
    .put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "SOME_ACTION");

    JTable.getActionMap().put("SOME_ACTION", actions);


    actions = new AbstractAction() {

    public void actionPerformed(ActionEvent ae) {
    //This action will get fired on Enter Key
    }
    };

Similar Threads

  1. Array traversal issues
    By sondratheloser in forum New To Java
    Replies: 3
    Last Post: 08-13-2012, 12:49 AM
  2. Bidirectional Traversal with ListIterator
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 10:37 PM
  3. how to focus to another JTextfield?
    By birdofprey in forum AWT / Swing
    Replies: 2
    Last Post: 04-09-2008, 01:08 PM
  4. Preorder Traversal problem...
    By tuckker in forum New To Java
    Replies: 3
    Last Post: 12-04-2007, 06:06 AM
  5. Focus
    By Marty in forum AWT / Swing
    Replies: 1
    Last Post: 05-31-2007, 02:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •