/** Post-processes an already constructed toolbar.
*/
private void processToolBar(JToolBar toolBar) {
for (int i = 0; i < toolBar.getComponentCount(); i++) {
Component element = toolBar.getComponent(i);
if (element instanceof JButton) {
JButton button = (JButton) element;
Action action = button.getAction();
if (action != null) {
getJGraph().addAccelerator(action);
}
}
}
// ensure the JGraph gets focus as soon as the graph panel
// is clicked anywhere
// for reasons not clear to me, mouse listeners do not work on
// the level of the JGraphPanel
toolBar.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
getJGraph().requestFocus();
}
});
}
GraphEditorTab.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:JavaGraph
作者:
评论列表
文章目录