Settings Dialogue Graphical Bug

This commit is contained in:
Konloch 2021-07-19 06:24:35 -07:00
parent c70c052f53
commit b8b4312e37

AI 샘플 코드 생성 중입니다

Loading...

View File

@ -54,7 +54,13 @@ public class SettingsDialogue extends JScrollPane
if(!(child instanceof JMenuItem))
continue;
options.add((JMenuItem) child);
JMenuItem menuItem = (JMenuItem) child;
options.add(menuItem);
//force unselect after a selection has been made
//this fixes a graphical bug from forcing menu items on non-menus
menuItem.addActionListener(e -> unselectAll());
}
this.options.addAll(options);
@ -64,11 +70,9 @@ public class SettingsDialogue extends JScrollPane
components.add(this);
}
private void buildPanel()
public void unselectAll()
{
display.setLayout(new BoxLayout(display, BoxLayout.Y_AXIS));
for(JMenuItem menuItem : options)
display.add(menuItem);
options.forEach(jMenuItem -> jMenuItem.setArmed(false));
}
public void showDialogue()
@ -76,6 +80,13 @@ public class SettingsDialogue extends JScrollPane
BetterJOptionPane.showJPanelDialogue(null, this, 460, dialogues::add);
}
private void buildPanel()
{
display.setLayout(new BoxLayout(display, BoxLayout.Y_AXIS));
for(JMenuItem menuItem : options)
display.add(menuItem);
}
@Override
public String getName()
{