fixed cursor color

This commit is contained in:
Radek Davidek 2026-04-07 15:18:59 +02:00
parent d0f93b19a9
commit 5ca8ced84a

View File

@ -1,6 +1,7 @@
package cz.kamma.jkeepass;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
@ -155,30 +156,6 @@ public class KeepassApp extends JFrame {
}
}
private JFrame createRestoreFrame() {
JFrame restoreFrame = new JFrame("JKeepass - Click to Restore");
restoreFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
restoreFrame.setAlwaysOnTop(true);
restoreFrame.setUndecorated(true);
restoreFrame.setOpacity(0.85f);
restoreFrame.setSize(160, 60);
restoreFrame.setLocation(20, 20);
restoreFrame.setType(JFrame.Type.UTILITY);
JButton restoreBtn = new JButton("Restore JKeepass");
restoreBtn.setFont(restoreBtn.getFont().deriveFont(12f));
restoreBtn.addActionListener(e -> {
setVisible(true);
setExtendedState(JFrame.NORMAL);
toFront();
requestFocus();
restoreFrame.dispose();
});
restoreFrame.add(restoreBtn);
return restoreFrame;
}
private void minimizeToCustomTray() {
// Lock and minimize
lockDatabase();
@ -940,6 +917,15 @@ public class KeepassApp extends JFrame {
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// Fix caret visibility in dark themes by ensuring it uses text foreground color
Color textColor = UIManager.getColor("TextField.foreground");
if (textColor == null) textColor = Color.BLACK;
UIManager.put("TextField.caretForeground", textColor);
UIManager.put("PasswordField.caretForeground", textColor);
UIManager.put("TextArea.caretForeground", textColor);
} catch (Exception ignored) {}
SwingUtilities.invokeLater(() -> {