This commit is contained in:
2025-12-22 09:24:35 -06:00
parent 751f878a32
commit b9c4c6f3e7
3 changed files with 27 additions and 8 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Ask2AgentMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

View File

@@ -2,9 +2,12 @@
<library name="lib">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/flatlaf-3.7.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/flatlaf-3.7-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/flatlaf-extras-3.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/flatlaf-extras-3.7-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/flatlaf-3.7-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -16,6 +16,7 @@ import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.*;
import com.formdev.flatlaf.FlatDarculaLaf;
import com.formdev.flatlaf.themes.FlatMacDarkLaf;
import com.formdev.flatlaf.FlatIntelliJLaf;
import java.util.prefs.Preferences;
import com.formdev.flatlaf.FlatLaf;
@@ -27,8 +28,9 @@ import dev.sillyangel.calc.themes.*;
public class Calculator extends JFrame implements KeyListener {
private static final String PREF_NODE_NAME = "dev/sillyangel/calc";
private static boolean
private static int
private static final String PREF_THEME = "theme";
private static final String PREF_FONT_SIZE = "fontSize";
private static final String PREF_ALWAYS_ON_TOP = "alwaysOnTop";
public static final Preferences prefs = Preferences.userRoot().node(PREF_NODE_NAME);
public static String APPILCATION_VERSION = "1.0.0pre";
private static final long serialVersionUID = 1L;
@@ -53,9 +55,9 @@ public class Calculator extends JFrame implements KeyListener {
public static void main(String[] args) {
// IntelliJTheme.setup(Calculator.class.getResourceAsStream("/DarkPurple.theme.json"));
// FlatMacDarkLaf.setup();
FlatMacDarkLaf.setup();
// MacDarkRed.setup();
MacDarkBlue.setup();
// MacDarkBlue.setup();
System.out.println("\nangel's awesome calculator (acc) " + Calculator.getVersion());
System.out.println("created by angel");
System.out.println("---------------------------------");
@@ -68,8 +70,7 @@ public class Calculator extends JFrame implements KeyListener {
JFrame.setDefaultLookAndFeelDecorated(true);
}
try {
// UIManager.setLookAndFeel("com.formdev.flatlaf.themes.FlatMacDarkLaf");
UIManager.put("defaultFont", new Font("Segoe UI", Font.PLAIN, 29));
UIManager.setLookAndFeel("com.formdev.flatlaf.themes.FlatMacDarkLaf");
} catch (Throwable e) {
e.printStackTrace();
}
@@ -707,6 +708,12 @@ public class Calculator extends JFrame implements KeyListener {
System.out.println("Op2: " + op2);
}
// Save calculation to history
if (!operator.isEmpty()) {
String calculation = operand1 + " " + operator + " " + operand2 + " = " + result;
history.saveToHistory(calculation);
}
operator = "";
operand1 = "";
operand2 = "";
@@ -749,6 +756,9 @@ public class Calculator extends JFrame implements KeyListener {
}
}
private boolean isCustomMacTheme(String theme) {
return theme.equalsIgnoreCase("macdarkblue") || theme.equalsIgnoreCase("macdarkred");
}
// Implement the keyPressed method