mirror of
https://github.com/SKCraft/Launcher.git
synced 2024-11-30 13:13:58 +01:00
Select nearest entry on right click of instance list.
This commit is contained in:
parent
991d39ced6
commit
1673dc57e8
@ -154,9 +154,14 @@ public class LauncherFrame extends JFrame {
|
||||
@Override
|
||||
protected void showPopup(MouseEvent e) {
|
||||
//noinspection unchecked
|
||||
Instance selected = ((JList<Instance>) e.getSource()).getSelectedValue();
|
||||
if (selected != null) {
|
||||
JList<Instance> list = ((JList<Instance>) e.getSource());
|
||||
int index = list.locationToIndex(new Point(e.getX(), e.getY()));
|
||||
if (index >= 0) {
|
||||
list.setSelectedIndex(list.locationToIndex(new Point(e.getX(), e.getY())));
|
||||
Instance selected = list.getSelectedValue();
|
||||
popupInstanceMenu(e.getComponent(), e.getX(), e.getY(), selected);
|
||||
} else {
|
||||
list.setSelectedValue(null, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user