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

lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 38e2a66  [NETBEANS-3664] Fix usage of LaF getDefaults() method
38e2a66 is described below

commit 38e2a66ddefbcbd25686d28566b9dd243a7ddf70
Author: Karl Tauber <k...@jformdesigner.com>
AuthorDate: Fri Jan 3 22:31:11 2020 +0100

    [NETBEANS-3664] Fix usage of LaF getDefaults() method
---
 ide/editor/src/org/netbeans/modules/editor/NbEditorKit.java  | 11 ++++-------
 .../src/org/netbeans/core/windows/view/ui/MainWindow.java    | 12 ++++++------
 .../src/org/netbeans/swing/plaf/LFCustoms.java               |  9 ++++-----
 .../netbeans/modules/profiler/heapwalk/oql/ui/OQLEditor.java |  2 +-
 4 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/ide/editor/src/org/netbeans/modules/editor/NbEditorKit.java 
b/ide/editor/src/org/netbeans/modules/editor/NbEditorKit.java
index 0ded71a..c4076b9 100644
--- a/ide/editor/src/org/netbeans/modules/editor/NbEditorKit.java
+++ b/ide/editor/src/org/netbeans/modules/editor/NbEditorKit.java
@@ -25,8 +25,6 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.awt.event.KeyEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -50,7 +48,6 @@ import javax.swing.Action;
 import javax.swing.JCheckBoxMenuItem;
 import javax.swing.JEditorPane;
 import javax.swing.KeyStroke;
-import javax.swing.LookAndFeel;
 import javax.swing.UIDefaults;
 import javax.swing.UIManager;
 import javax.swing.text.Document;
@@ -103,7 +100,6 @@ import org.openide.filesystems.FileUtil;
 import org.openide.util.ContextAwareAction;
 import org.openide.util.Lookup;
 import org.openide.util.NbBundle;
-import org.openide.util.RequestProcessor;
 
 /**
 * Java editor kit with appropriate document
@@ -137,9 +133,10 @@ public class NbEditorKit extends ExtKit implements 
Callable {
     static {
         
         // Ensure that Nimbus L&F does not have the scrollbar size too small 
for large files
-        LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
-        UIDefaults defaults = lookAndFeel.getDefaults();
-        defaults.put("ScrollBar.minimumThumbSize", new Dimension(20, 20));
+        if (UIManager.getLookAndFeel().getID().equals("Nimbus")) {
+            UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+            defaults.put("ScrollBar.minimumThumbSize", new Dimension(20, 20));
+        }
 
         contentTypeTable = new HashMap<String, String>();
         
contentTypeTable.put("org.netbeans.modules.properties.syntax.PropertiesKit", 
"text/x-properties"); // NOI18N
diff --git 
a/platform/core.windows/src/org/netbeans/core/windows/view/ui/MainWindow.java 
b/platform/core.windows/src/org/netbeans/core/windows/view/ui/MainWindow.java
index 3f44af6..40b42e2 100755
--- 
a/platform/core.windows/src/org/netbeans/core/windows/view/ui/MainWindow.java
+++ 
b/platform/core.windows/src/org/netbeans/core/windows/view/ui/MainWindow.java
@@ -83,7 +83,7 @@ public final class MainWindow {
    private JComponent statusBar;
 
    private static final Logger LOGGER = 
Logger.getLogger(MainWindow.class.getName());
-   
+
    //update main window title bar when current document is modified (Mac OS X 
only)
    private final RequestProcessor RP = new RequestProcessor( "MainWndMac", 1 
); //NOI18N
 
@@ -159,7 +159,7 @@ public final class MainWindow {
            return;
        }
        inited = true;
-       
+
        JPanel contentPane = new JPanel(new BorderLayout()) {
            @Override
            public void paint(Graphics g) {
@@ -475,7 +475,7 @@ public final class MainWindow {
             statusBarContainer.add( statusBar, BorderLayout.CENTER );
         }
     }
-    
+
    static private class StatusLineElementsListener implements LookupListener {
        private JPanel decoratingPanel;
        StatusLineElementsListener (JPanel decoratingPanel) {
@@ -732,7 +732,7 @@ public final class MainWindow {
 
 
    public void setFullScreenMode( boolean fullScreenMode ) {
-       if( isFullScreenMode == fullScreenMode || isSwitchingFullScreenMode 
+       if( isFullScreenMode == fullScreenMode || isSwitchingFullScreenMode
                || Utilities.isMac()) { //Mac OS X has its own built-in full 
screen support, see applemenu module
            return;
        }
@@ -743,7 +743,7 @@ public final class MainWindow {
            isUndecorated = frame.isUndecorated();
            windowDecorationStyle = 
frame.getRootPane().getWindowDecorationStyle();
        }
-       
+
        final TopComponent activeTc = TopComponent.getRegistry().getActivated();
 
        GraphicsDevice device = null;
@@ -885,7 +885,7 @@ public final class MainWindow {
         Logger logger = Logger.getLogger( "org.netbeans.ui.metrics.laf" );   
// NOI18N
         LogRecord rec = new LogRecord( Level.INFO, "USG_LOOK_AND_FEEL" ); 
//NOI18N
         String lafId = laf.getID();
-        if( laf.getDefaults().getBoolean( "nb.dark.theme" ) ) //NOI18N
+        if( UIManager.getLookAndFeelDefaults().getBoolean( "nb.dark.theme" ) ) 
//NOI18N
         {
             lafId = "DARK " + lafId; //NOI18N
         }
diff --git a/platform/o.n.swing.plaf/src/org/netbeans/swing/plaf/LFCustoms.java 
b/platform/o.n.swing.plaf/src/org/netbeans/swing/plaf/LFCustoms.java
index d8d3347..770d698 100644
--- a/platform/o.n.swing.plaf/src/org/netbeans/swing/plaf/LFCustoms.java
+++ b/platform/o.n.swing.plaf/src/org/netbeans/swing/plaf/LFCustoms.java
@@ -22,7 +22,6 @@ package org.netbeans.swing.plaf;
 import java.awt.Color;
 import java.util.logging.Logger;
 import javax.swing.UIManager;
-import javax.swing.plaf.ColorUIResource;
 import javax.swing.text.AttributeSet;
 
 /** Look and feel customizations interface.
@@ -79,9 +78,9 @@ public abstract class LFCustoms {
     public static String getTextFgColorHTML() {
         synchronized(LFCustoms.class) {
             if (textFgColorHTML.isEmpty()) {
-                    Object o = 
UIManager.getLookAndFeel().getDefaults().get("windowText");
+                    Object o = 
UIManager.getLookAndFeelDefaults().get("windowText");
                     if( null == o )
-                        o = 
UIManager.getLookAndFeel().getDefaults().get("Tree.foreground");
+                        o = 
UIManager.getLookAndFeelDefaults().get("Tree.foreground");
                     if (o instanceof Color) {
                             Color resource = (Color)o;
                             textFgColorHTML = "<font color=#" + 
getHexString(resource.getRed()) + getHexString(resource.getGreen()) + 
getHexString(resource.getBlue())+">";
@@ -103,9 +102,9 @@ public abstract class LFCustoms {
     public static Color getTextFgColor() {
         synchronized(LFCustoms.class) {
             if (textFgColor == null) {
-                Object o = 
UIManager.getLookAndFeel().getDefaults().get("windowText");
+                Object o = 
UIManager.getLookAndFeelDefaults().get("windowText");
                 if( null == o )
-                    o = 
UIManager.getLookAndFeel().getDefaults().get("Tree.foreground");
+                    o = 
UIManager.getLookAndFeelDefaults().get("Tree.foreground");
                 if (o instanceof Color) {
                     textFgColor = (Color) o;
                 } else {
diff --git 
a/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/oql/ui/OQLEditor.java
 
b/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/oql/ui/OQLEditor.java
index 375641f..b6bcf1c 100644
--- 
a/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/oql/ui/OQLEditor.java
+++ 
b/profiler/profiler.heapwalker/src/org/netbeans/modules/profiler/heapwalk/oql/ui/OQLEditor.java
@@ -58,7 +58,7 @@ public class OQLEditor extends JPanel {
     final private OQLEngine engine;
 
     final private Color disabledBgColor = UIUtils.isGTKLookAndFeel() ?
-                  UIManager.getLookAndFeel().getDefaults().getColor("desktop") 
: // NOI18N
+                  UIManager.getLookAndFeelDefaults().getColor("desktop") : // 
NOI18N
                   UIManager.getColor("TextField.disabledBackground"); // NOI18N
 
     final private transient Caret nullCaret = new NoCaret();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to