< prev index next >

src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java

Print this page


   1 /*
   2  * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


1480                 // PropertyChanges, remove the listener.
1481                 dispose();
1482             }
1483             else {
1484                 // We are using invokeLater here because we are getting called
1485                 // on the AWT-Motif thread which can cause a deadlock.
1486                 SwingUtilities.invokeLater(new Runnable() {
1487                     public void run() {
1488                         String name = pce.getPropertyName();
1489                         /* We are listening for GTK desktop text AA settings:
1490                          * "gnome.Xft/Antialias" and "gnome.Xft/RGBA".
1491                          * However we don't need to read these here as
1492                          * the UIDefaults reads them and this event causes
1493                          * those to be reinitialised.
1494                          */
1495                         if ("gnome.Net/ThemeName".equals(name)) {
1496                             GTKEngine.INSTANCE.themeChanged();
1497                             GTKIconFactory.resetIcons();
1498                         }
1499                         lnf.loadStyles();
1500                         Window appWindows[] = Window.getWindows();
1501                         for (int i = 0; i < appWindows.length; i++) {
1502                             SynthLookAndFeel.updateStyles(appWindows[i]);
1503                         }
1504                     }
1505                 });
1506             }
1507         }
1508 
1509         void dispose() {
1510             kit.removePropertyChangeListener(key, this);
1511         }
1512     }
1513 
1514     public boolean isSupportedLookAndFeel() {
1515         Toolkit toolkit = Toolkit.getDefaultToolkit();
1516         return (toolkit instanceof SunToolkit &&
1517                 ((SunToolkit)toolkit).isNativeGTKAvailable());
1518     }
1519 
1520     public boolean isNativeLookAndFeel() {


   1 /*
   2  * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


1480                 // PropertyChanges, remove the listener.
1481                 dispose();
1482             }
1483             else {
1484                 // We are using invokeLater here because we are getting called
1485                 // on the AWT-Motif thread which can cause a deadlock.
1486                 SwingUtilities.invokeLater(new Runnable() {
1487                     public void run() {
1488                         String name = pce.getPropertyName();
1489                         /* We are listening for GTK desktop text AA settings:
1490                          * "gnome.Xft/Antialias" and "gnome.Xft/RGBA".
1491                          * However we don't need to read these here as
1492                          * the UIDefaults reads them and this event causes
1493                          * those to be reinitialised.
1494                          */
1495                         if ("gnome.Net/ThemeName".equals(name)) {
1496                             GTKEngine.INSTANCE.themeChanged();
1497                             GTKIconFactory.resetIcons();
1498                         }
1499                         lnf.loadStyles();
1500                         Window[] appWindows = Window.getWindows();
1501                         for (int i = 0; i < appWindows.length; i++) {
1502                             SynthLookAndFeel.updateStyles(appWindows[i]);
1503                         }
1504                     }
1505                 });
1506             }
1507         }
1508 
1509         void dispose() {
1510             kit.removePropertyChangeListener(key, this);
1511         }
1512     }
1513 
1514     public boolean isSupportedLookAndFeel() {
1515         Toolkit toolkit = Toolkit.getDefaultToolkit();
1516         return (toolkit instanceof SunToolkit &&
1517                 ((SunToolkit)toolkit).isNativeGTKAvailable());
1518     }
1519 
1520     public boolean isNativeLookAndFeel() {


< prev index next >