help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
java-math-tools
/
src
/
main
/
java
/
com
/
rskworld
/
mathtools
/
utils
RSK World
java-math-tools
Java Math Tools - 15 Mathematical Tools + Scientific Calculator + Geometry + Statistics + Financial Calculators + Swing GUI + Educational Design
utils
  • HistoryManager.java1019 B
  • ThemeManager.java2.9 KB
ThemeManager.java
src/main/java/com/rskworld/mathtools/utils/ThemeManager.java
Raw Download
Find: Go to:
/**
 * Project: Java Basic Math Tools
 * Developer: Molla Samser
 * Designer & Tester: Rima Khatun
 * Website: https://rskworld.in
 * Year: 2026
 */

package com.rskworld.mathtools.utils;

import java.awt.*;
import javax.swing.JComponent;
import javax.swing.UIManager;

public class ThemeManager {
    // Primary Colors - Professional Dark Theme with Red Accents (rskworld.in style)
    public static final Color BACKGROUND = new Color(20, 20, 20); // Darker
    public static final Color PANEL_BACKGROUND = new Color(30, 30, 30);
    public static final Color ACCENT_RED = new Color(255, 50, 50); // Brighter Red
    public static final Color TEXT_PRIMARY = Color.WHITE; // Absolute White
    public static final Color INPUT_BG = new Color(45, 45, 45);
    public static final Color BUTTON_BG = new Color(60, 60, 60);

    public static void initGlobalTheme() {
        UIManager.put("Panel.background", BACKGROUND);
        UIManager.put("TabbedPane.background", PANEL_BACKGROUND);
        UIManager.put("TabbedPane.foreground", TEXT_PRIMARY);
        UIManager.put("TabbedPane.selected", ACCENT_RED);
        UIManager.put("TextField.background", INPUT_BG);
        UIManager.put("TextField.foreground", TEXT_PRIMARY);
        UIManager.put("TextArea.background", INPUT_BG);
        UIManager.put("TextArea.foreground", TEXT_PRIMARY);
        UIManager.put("Label.foreground", TEXT_PRIMARY);
        UIManager.put("Button.background", BUTTON_BG);
        UIManager.put("Button.foreground", TEXT_PRIMARY);
        UIManager.put("ComboBox.background", INPUT_BG);
        UIManager.put("ComboBox.foreground", TEXT_PRIMARY);
        UIManager.put("ScrollPane.background", BACKGROUND);
        UIManager.put("Viewport.background", BACKGROUND);
    }

    public static void applyTheme(Container container) {
        // No recursion! This was causing the hangs.
        // rely on UIManager globals and simple direct styling.
        container.setBackground(BACKGROUND);
        if (container instanceof JComponent) {
            ((JComponent) container).setOpaque(true);
        }

        for (Component c : container.getComponents()) {
            c.setBackground(BACKGROUND);
            c.setForeground(TEXT_PRIMARY);
            
            if (c instanceof JComponent) {
                ((JComponent) c).setOpaque(true);
            }

            if (c instanceof javax.swing.JButton) {
                javax.swing.JButton btn = (javax.swing.JButton) c;
                btn.setBackground(BUTTON_BG);
                btn.setBorder(javax.swing.BorderFactory.createLineBorder(ACCENT_RED, 1));
            } else if (c instanceof javax.swing.text.JTextComponent) {
                c.setBackground(INPUT_BG);
            } else if (c instanceof javax.swing.JComboBox || c instanceof javax.swing.JCheckBox) {
                c.setBackground(INPUT_BG);
            }
        }
    }
}
70 lines•2.9 KB
java

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer