Java Swing UIManager getGtkThemeName()

Here you can find the source of getGtkThemeName()

Description

get Gtk Theme Name

License

Apache License

Declaration

public static String getGtkThemeName() 

Method Source Code


//package com.java2s;
/*/*from w  w  w  . j av a 2s.c  o m*/
 * Copyright 2012 Miklos Juhasz (mjuhasz), JetBrains s.r.o.
 *
 * Licensed 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.
 */

import javax.swing.*;

import java.lang.reflect.Method;

public class Main {
    public static String getGtkThemeName() {
        final LookAndFeel laf = UIManager.getLookAndFeel();
        if (laf != null && "GTKLookAndFeel".equals(laf.getClass().getSimpleName())) {
            try {
                final Method method = laf.getClass().getDeclaredMethod("getGtkThemeName");
                method.setAccessible(true);
                final Object theme = method.invoke(laf);
                if (theme != null) {
                    return theme.toString();
                }
            } catch (Exception ignored) {
            }
        }
        return null;
    }
}

Related

  1. getDefaultFieldHeigth()
  2. getDefaultForeground()
  3. getDefaultInactiveBackgroundColour()
  4. getErrorIcon()
  5. getGrayFilter()
  6. getHyperlinkForeground()
  7. getIcon(String iconResource)
  8. getIconForeground()
  9. getListBackground(final boolean selected)