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;

// all methods are static
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(); // class Color implements Paint
            }
        }
        
        return current;
    }
    
    static Paint getBackgroundPaint(Paint current, Object o) {
        if (current == null) {
            if (o instanceof Component) {
                return ((Component) o).getBackground(); // class Color implements Paints
            }
        }
        
        return current;
    }
    
    static Font getComponentFont(Font current, Object o) {
        if (current == null) {
            if (o instanceof Component) {
                return ((Component) o).getFont();
            }
        }
        
        return current;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy