This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/master by this push:
     new 220eda835 simplifying MacUIInitializer
220eda835 is described below

commit 220eda8353b9571d8658af38ca25a60fe4105d6f
Author: Andrus Adamchik <[email protected]>
AuthorDate: Thu Aug 27 14:31:48 2026 -0400

    simplifying MacUIInitializer
    
    all the customizations are no longer applicable with the new L&F. The result
    seems identical to 5.0-M3
---
 .../cayenne/modeler/platform/mac/MacOSVersion.java | 55 ------------------
 .../cayenne/modeler/platform/mac/MacPanelUI.java   | 67 ----------------------
 .../modeler/platform/mac/MacUIInitializer.java     | 27 ---------
 3 files changed, 149 deletions(-)

diff --git 
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/platform/mac/MacOSVersion.java
 
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/platform/mac/MacOSVersion.java
deleted file mode 100644
index 38a6adef1..000000000
--- 
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/platform/mac/MacOSVersion.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-
-package org.apache.cayenne.modeler.platform.mac;
-
-import org.apache.cayenne.modeler.service.os.OperatingSystem;
-
-public record MacOSVersion(int major, int minor) {
-
-    public static final MacOSVersion UNKNOWN = new MacOSVersion(-1, -1);
-    public static final MacOSVersion CATALINA = new MacOSVersion(10, 15);
-    public static final MacOSVersion BIG_SUR = new MacOSVersion(10, 16);
-
-    public static MacOSVersion fromSystemProperties() {
-
-        // sanity check in case this code executed not on macOS
-        if (OperatingSystem.os != OperatingSystem.MAC_OS) {
-            return UNKNOWN;
-        }
-
-        String osVersion = System.getProperty("os.version");
-        String[] osVersionComponents = osVersion.split("\\.");
-        if (osVersionComponents.length != 2) {
-            return UNKNOWN;
-        }
-
-        try {
-            int major = Integer.parseInt(osVersionComponents[0]);
-            int minor = Integer.parseInt(osVersionComponents[1]);
-            return new MacOSVersion(major, minor);
-        } catch (Exception ex) {
-            return UNKNOWN;
-        }
-    }
-
-    public boolean gt(MacOSVersion version) {
-        return major() > version.major() || (major() == version.major() && 
minor() > version.minor());
-    }
-}
diff --git 
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/platform/mac/MacPanelUI.java
 
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/platform/mac/MacPanelUI.java
deleted file mode 100644
index e5ef62fe2..000000000
--- 
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/platform/mac/MacPanelUI.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    https://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-
-package org.apache.cayenne.modeler.platform.mac;
-
-import javax.swing.*;
-import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.basic.BasicPanelUI;
-import java.awt.*;
-
-public class MacPanelUI extends BasicPanelUI {
-
-    private static final Color BACKGROUND = new Color(0xEEEEEE);
-
-    private static final MacPanelUI INSTANCE;
-
-    static {
-        BasicPanelUI delegate;
-        try {
-            @SuppressWarnings("unchecked")
-            Class<? extends BasicPanelUI> delegateClass = (Class<? extends 
BasicPanelUI>)
-                    Class.forName("com.apple.laf.AquaPanelUI");
-            delegate = delegateClass.getDeclaredConstructor().newInstance();
-        } catch (Exception ex) {
-            delegate = new BasicPanelUI();
-        }
-
-        INSTANCE = new MacPanelUI(delegate);
-    }
-
-    private final BasicPanelUI delegate;
-
-    private MacPanelUI(BasicPanelUI delegate) {
-        this.delegate = delegate;
-    }
-
-    public static ComponentUI createUI(JComponent c) {
-        return INSTANCE;
-    }
-
-    @Override
-    protected void installDefaults(JPanel p) {
-        super.installDefaults(p);
-        p.setBackground(BACKGROUND);
-    }
-
-    @Override
-    public void update(Graphics g, JComponent c) {
-        delegate.update(g, c);
-    }
-}
diff --git 
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/platform/mac/MacUIInitializer.java
 
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/platform/mac/MacUIInitializer.java
index 5029be0eb..44f7b6462 100644
--- 
a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/platform/mac/MacUIInitializer.java
+++ 
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/platform/mac/MacUIInitializer.java
@@ -27,8 +27,6 @@ import 
org.apache.cayenne.modeler.ui.action.ConfigurePreferencesAction;
 import org.apache.cayenne.modeler.ui.action.ExitAction;
 
 import javax.swing.*;
-import javax.swing.border.AbstractBorder;
-import javax.swing.border.Border;
 import java.awt.*;
 import java.util.HashSet;
 import java.util.Set;
@@ -45,28 +43,6 @@ public class MacUIInitializer extends GenericUIInitializer {
         System.setProperty("apple.awt.application.name", "CayenneModeler");
 
         super.beforeSwingLaunch();
-
-        Color lightGrey = new Color(0xEEEEEE);
-        UIManager.put("PanelUI", MacPanelUI.class.getName());
-
-        // MacOS BigSur needs additional style tweaking for the tabs active 
state
-        MacOSVersion version = MacOSVersion.fromSystemProperties();
-        if (version.gt(MacOSVersion.CATALINA)) {
-            UIManager.put("TabbedPane.selectedTabTitlePressedColor", 
Color.BLACK);
-            UIManager.put("TabbedPane.selectedTabTitleNormalColor", 
Color.BLACK);
-            UIManager.put("TabbedPane.selectedTabTitleShadowDisabledColor", 
new Color(0, 0, 0, 0));
-            UIManager.put("TabbedPane.selectedTabTitleShadowNormalColor", new 
Color(0, 0, 0, 0));
-        }
-
-        Border backgroundPainter = new AbstractBorder() {
-            @Override
-            public void paintBorder(Component c, Graphics g, int x, int y, int 
width, int height) {
-                g.setColor(lightGrey);
-                g.fillRect(0, 0, width - 1, height - 1);
-            }
-        };
-        UIManager.put("MenuItem.selectedBackgroundPainter", backgroundPainter);
-        UIManager.put("MenuItem.selectionForeground", Color.BLACK);
     }
 
     @Override
@@ -88,9 +64,6 @@ public class MacUIInitializer extends GenericUIInitializer {
     @Override
     public void afterFrameCreated(Application app) {
 
-        // set additional look and feel for the window
-        
app.getFrame().getRootPane().putClientProperty("apple.awt.brushMetalLook", 
Boolean.TRUE);
-
         // Only relocate About/Preferences/Quit to the macOS application menu 
when the
         // screen menu bar is actually in use. Otherwise the JMenuBar stays 
inside the
         // window frame, and stripping these items would make them 
inaccessible.

Reply via email to