fix(gui): improve accessibility of preferences dialog (#2445)
This commit is contained in:
@@ -142,6 +142,7 @@ public class JadxSettingsWindow extends JDialog {
|
||||
|
||||
tree = new SettingsTree();
|
||||
tree.init(wrapGroupPanel, groups);
|
||||
tree.setFocusable(true);
|
||||
JScrollPane leftPane = new JScrollPane(tree);
|
||||
leftPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 3, 3));
|
||||
|
||||
|
||||
@@ -39,10 +39,18 @@ public class SettingsGroup implements ISettingsGroup {
|
||||
}
|
||||
|
||||
public JLabel addRow(String label, String tooltip, JComponent comp) {
|
||||
c.gridy = row++;
|
||||
JLabel rowLbl = new JLabel(label);
|
||||
rowLbl.setLabelFor(comp);
|
||||
rowLbl.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
if (tooltip != null) {
|
||||
rowLbl.setToolTipText(tooltip);
|
||||
comp.setToolTipText(tooltip);
|
||||
} else {
|
||||
comp.setToolTipText(label);
|
||||
}
|
||||
comp.getAccessibleContext().setAccessibleName(label);
|
||||
|
||||
c.gridy = row++;
|
||||
c.gridx = 0;
|
||||
c.gridwidth = 1;
|
||||
c.anchor = GridBagConstraints.LINE_START;
|
||||
@@ -55,10 +63,6 @@ public class SettingsGroup implements ISettingsGroup {
|
||||
c.weightx = 0.7;
|
||||
c.fill = GridBagConstraints.LINE_START;
|
||||
|
||||
if (tooltip != null) {
|
||||
rowLbl.setToolTipText(tooltip);
|
||||
comp.setToolTipText(tooltip);
|
||||
}
|
||||
gridPanel.add(comp, c);
|
||||
comp.addPropertyChangeListener("enabled", evt -> rowLbl.setEnabled((boolean) evt.getNewValue()));
|
||||
return rowLbl;
|
||||
|
||||
@@ -96,6 +96,7 @@ class PluginSettingsGroup implements ISettingsGroup {
|
||||
pluginList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
pluginList.setCellRenderer(new PluginsListCellRenderer());
|
||||
pluginList.addListSelectionListener(ev -> onSelection(pluginList.getSelectedValue()));
|
||||
pluginList.setFocusable(true);
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane(pluginList);
|
||||
scrollPane.setMinimumSize(new Dimension(80, 120));
|
||||
@@ -276,8 +277,7 @@ class PluginSettingsGroup implements ISettingsGroup {
|
||||
|
||||
titleLbl = new JLabel();
|
||||
titleLbl.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
titleLbl.setEnabled(false);
|
||||
versionLbl.setPreferredSize(new Dimension(40, 10));
|
||||
titleLbl.setPreferredSize(new Dimension(40, 10));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -290,6 +290,7 @@ class PluginSettingsGroup implements ISettingsGroup {
|
||||
nameLbl.setText(plugin.getTitle());
|
||||
nameLbl.setToolTipText(plugin.getLocationId());
|
||||
versionLbl.setText(Utils.getOrElse(plugin.getVersion(), ""));
|
||||
panel.getAccessibleContext().setAccessibleName(plugin.getTitle());
|
||||
|
||||
boolean enabled = !plugin.isDisabled();
|
||||
nameLbl.setEnabled(enabled);
|
||||
|
||||
Reference in New Issue
Block a user