Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbilityPicker Empty Selection Error #13186

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void initComponents() {
setBackgroundPainter(mwPanelPainter);

title = new ColorPane();
title.setFont(new Font("Times New Roman", 1, sizeMod(15)));
title.setFont(new Font("Times New Roman", Font.BOLD, sizeMod(15)));
title.setEditable(false);
title.setFocusCycleRoot(false);
title.setOpaque(false);
Expand Down Expand Up @@ -186,11 +186,12 @@ private void initComponents() {
rows.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent evt) {
if (SwingUtilities.isLeftMouseButton(evt)) {
if (SwingUtilities.isLeftMouseButton(evt) && !rows.isSelectionEmpty()) {
objectMouseClicked(evt);
}
}
});

rows.setSelectedIndex(0);
rows.setFont(new Font("Times New Roman", 1, sizeMod(17)));
rows.setBorder(BorderFactory.createEmptyBorder());
Expand Down Expand Up @@ -233,18 +234,16 @@ public void mousePressed(MouseEvent evt) {

@Override
public void mouseWheelMoved(MouseWheelEvent e) {
int notches = e.getWheelRotation();
int index = rows.getSelectedIndex();

if (notches < 0) {
if (index > 0) {
rows.setSelectedIndex(index - 1);
rows.repaint();
}
} else if (index < choices.size() - 1) {
rows.setSelectedIndex(index + 1);
rows.repaint();
int direction = e.getWheelRotation() < 0 ? -1 : +1;
int index = rows.getSelectedIndex() + direction;
if (index < 0) {
index = 0;
} else if (index >= choices.size()) {
index = choices.size() - 1;
}

rows.setSelectedIndex(index);
rows.repaint();
}

private void objectMouseClicked(MouseEvent event) {
Expand Down
Loading