All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jdesktop.swingx.painter.PainterUtils Maven / Gradle / Ivy

The newest version!
package org.jdesktop.swingx.painter;

import java.awt.Component;
import java.awt.Font;
import java.awt.Paint;

final class PainterUtils {
    private PainterUtils() {
        //prevent instantiation
    }
    
    static Paint getForegroundPaint(Paint current, Object o) {
        if (current == null) {
            if (o instanceof Component) {
                return ((Component) o).getForeground();
            }
        }
        
        return current;
    }
    
    static Paint getBackgroundPaint(Paint current, Object o) {
        if (current == null) {
            if (o instanceof Component) {
                return ((Component) o).getBackground();
            }
        }
        
        return current;
    }
    
    static Font getComponentFont(Font current, Object o) {
        if (current == null) {
            if (o instanceof Component) {
                return ((Component) o).getFont();
            }
        }
        
        return current;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy