JScrollPane in JTables

前端 未结 1 1667
暖寄归人
暖寄归人 2020-12-21 21:50

I wonder if you guys had problem such if you got some JPanel which got his own JScrollPane and in your panel you are using a lot of JTable

相关标签:
1条回答
  • 2020-12-21 22:47

    Yes, JTable understands several named scrolling actions, listed below. They are normally used in key bindings, but you can evoke them yourself, as shown in this related example that commandeers the actions defined for a scroll pane.

    Addendum: In outline, get the named action from the component's action map:

    Action action = table.getActionMap().get(name);
    

    Evoke the action by name when needed:

    action.actionPerformed(new ActionEvent(table, 0, name));
    

    Scrolling related action names for JTable:

    scrollDownChangeSelection
    scrollDownExtendSelection
    scrollLeftChangeSelection
    scrollLeftExtendSelection
    scrollRightChangeSelection
    scrollRightExtendSelection
    scrollUpChangeSelection
    scrollUpExtendSelection
    
    0 讨论(0)
提交回复
热议问题