public void mouseClicked(MouseEvent evt) {
openScript(tree.getSelectionPath());
}
});
// track enter key
tree.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_ENTER)
openScript(tree.getSelectionPath());
}
});
JScrollPane treeScroller = new JScrollPane(tree);
treeScroller.setPreferredSize(new Dimension(180, 300));
list = new JList();
// no bold font lists for me, thanks
list.setFont(list.getFont().deriveFont(Font.PLAIN));
list.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
openFunction((FunctionItem) list.getSelectedValue());
}
});
list.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_ENTER)
openFunction((FunctionItem) list.getSelectedValue());
}
});