Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import javax.swing.*;
import javax.swing.plaf.*;

import java.lang.reflect.*;

public class Main {
    public static ComponentUI getUI(JComponent component) {
        try {
            Method method = component.getClass().getMethod("getUI", new Class[0]);
            Object o = method.invoke(component, new Object[0]);
            if (o instanceof ComponentUI)
                return (ComponentUI) o;
            else
                return null;
        } catch (Exception e) {
            return null;
        }
    }
}