fixed menu
This commit is contained in:
parent
e72f9d602f
commit
571cf2cb68
@ -778,6 +778,8 @@ public class MainWindow extends JFrame {
|
|||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
if (SwingUtilities.isLeftMouseButton(e)) {
|
if (SwingUtilities.isLeftMouseButton(e)) {
|
||||||
|
// Close the menu first to release focus
|
||||||
|
MenuSelectionManager.defaultManager().clearSelectedPath();
|
||||||
showSettingsDialog();
|
showSettingsDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -239,6 +239,14 @@ public class SettingsDialog extends JDialog {
|
|||||||
btns.add(ok);
|
btns.add(ok);
|
||||||
btns.add(cancel);
|
btns.add(cancel);
|
||||||
add(btns, BorderLayout.SOUTH);
|
add(btns, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
// Ensure dialog has focus when opened
|
||||||
|
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||||
|
@Override
|
||||||
|
public void windowOpened(java.awt.event.WindowEvent e) {
|
||||||
|
categoryList.requestFocusInWindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel buildAppearancePanel() {
|
private JPanel buildAppearancePanel() {
|
||||||
@ -640,6 +648,7 @@ public class SettingsDialog extends JDialog {
|
|||||||
|
|
||||||
gbc.gridx = 1;
|
gbc.gridx = 1;
|
||||||
gbc.weightx = 0;
|
gbc.weightx = 0;
|
||||||
|
gbc.gridwidth = 2; // Span across the rest
|
||||||
JButton browseBtn = new JButton("Browse...");
|
JButton browseBtn = new JButton("Browse...");
|
||||||
browseBtn.addActionListener(e -> {
|
browseBtn.addActionListener(e -> {
|
||||||
JFileChooser chooser = new JFileChooser();
|
JFileChooser chooser = new JFileChooser();
|
||||||
@ -666,8 +675,18 @@ public class SettingsDialog extends JDialog {
|
|||||||
gbc.gridx = 0;
|
gbc.gridx = 0;
|
||||||
gbc.gridy++;
|
gbc.gridy++;
|
||||||
gbc.gridwidth = 1;
|
gbc.gridwidth = 1;
|
||||||
gbc.weightx = 0.5;
|
gbc.weightx = 0;
|
||||||
|
gbc.fill = GridBagConstraints.NONE;
|
||||||
|
gbc.anchor = GridBagConstraints.WEST;
|
||||||
|
|
||||||
|
JPanel actionBtnPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
||||||
JButton exportBtn = new JButton("Export");
|
JButton exportBtn = new JButton("Export");
|
||||||
|
JButton importBtn = new JButton("Import");
|
||||||
|
|
||||||
|
Dimension actionSize = new Dimension(100, exportBtn.getPreferredSize().height);
|
||||||
|
exportBtn.setPreferredSize(actionSize);
|
||||||
|
importBtn.setPreferredSize(actionSize);
|
||||||
|
|
||||||
exportBtn.addActionListener(e -> {
|
exportBtn.addActionListener(e -> {
|
||||||
String path = pathField.getText();
|
String path = pathField.getText();
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
@ -683,10 +702,7 @@ public class SettingsDialog extends JDialog {
|
|||||||
JOptionPane.showMessageDialog(this, "Error exporting configuration: " + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(this, "Error exporting configuration: " + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
p.add(exportBtn, gbc);
|
|
||||||
|
|
||||||
gbc.gridx = 1;
|
|
||||||
JButton importBtn = new JButton("Import");
|
|
||||||
importBtn.addActionListener(e -> {
|
importBtn.addActionListener(e -> {
|
||||||
String path = pathField.getText();
|
String path = pathField.getText();
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
@ -714,13 +730,18 @@ public class SettingsDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
p.add(importBtn, gbc);
|
|
||||||
|
actionBtnPanel.add(exportBtn);
|
||||||
|
actionBtnPanel.add(Box.createHorizontalStrut(10));
|
||||||
|
actionBtnPanel.add(importBtn);
|
||||||
|
p.add(actionBtnPanel, gbc);
|
||||||
|
|
||||||
// Add spacer
|
// Add spacer
|
||||||
gbc.gridx = 0;
|
gbc.gridx = 0;
|
||||||
gbc.gridy++;
|
gbc.gridy++;
|
||||||
gbc.gridwidth = 3;
|
gbc.gridwidth = 3;
|
||||||
gbc.weighty = 1.0;
|
gbc.weighty = 1.0;
|
||||||
|
gbc.fill = GridBagConstraints.BOTH;
|
||||||
p.add(new JPanel(), gbc);
|
p.add(new JPanel(), gbc);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user