8321140: Add comment to note difference in Metal's JButton margins

Reviewed-by: honkar, aivanov
This commit is contained in:
Damon Nguyen 2024-08-19 16:43:43 +00:00
parent 3ca359ad22
commit 6460b30048
2 changed files with 42 additions and 13 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -727,6 +727,8 @@ public abstract class BasicLookAndFeel extends LookAndFeel implements Serializab
"Button.highlight", controlLtHighlight,
"Button.border", buttonBorder,
"Button.margin", new InsetsUIResource(2, 14, 2, 14),
// The above margin has vastly larger horizontal values when
// compared to other look and feels that don't rely on these values
"Button.textIconGap", 4,
"Button.textShiftOffset", zero,
"Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,28 +25,53 @@
package javax.swing.plaf.metal;
import java.awt.*;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Frame;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.Window;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.plaf.*;
import javax.swing.*;
import javax.swing.plaf.basic.*;
import javax.swing.text.DefaultEditorKit;
import java.awt.Color;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.security.AccessController;
import sun.awt.*;
import javax.swing.ButtonModel;
import javax.swing.DefaultButtonModel;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JRootPane;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.LayoutStyle;
import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.InsetsUIResource;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicLookAndFeel;
import javax.swing.text.DefaultEditorKit;
import sun.awt.AppContext;
import sun.awt.OSInfo;
import sun.awt.SunToolkit;
import sun.security.action.GetPropertyAction;
import sun.swing.DefaultLayoutStyle;
import static javax.swing.UIDefaults.LazyValue;
import sun.swing.SwingAccessor;
import sun.swing.SwingUtilities2;
import static javax.swing.UIDefaults.LazyValue;
/**
* The Java Look and Feel, otherwise known as Metal.
* <p>
@ -782,6 +807,8 @@ public class MetalLookAndFeel extends BasicLookAndFeel
"SPACE", "pressed",
"released SPACE", "released"
}),
// Button default margin is (2, 14, 2, 14), defined in
// BasicLookAndFeel via "Button.margin" UI property.
"CheckBox.disabledText", inactiveControlTextColor,
"Checkbox.select", controlShadow,