001package org.jdesktop.swingx.painter; 002 003import java.awt.Component; 004import java.awt.Font; 005import java.awt.Paint; 006 007final class PainterUtils { 008 private PainterUtils() { 009 //prevent instantiation 010 } 011 012 static Paint getForegroundPaint(Paint current, Object o) { 013 if (current == null) { 014 if (o instanceof Component) { 015 return ((Component) o).getForeground(); 016 } 017 } 018 019 return current; 020 } 021 022 static Paint getBackgroundPaint(Paint current, Object o) { 023 if (current == null) { 024 if (o instanceof Component) { 025 return ((Component) o).getBackground(); 026 } 027 } 028 029 return current; 030 } 031 032 static Font getComponentFont(Font current, Object o) { 033 if (current == null) { 034 if (o instanceof Component) { 035 return ((Component) o).getFont(); 036 } 037 } 038 039 return current; 040 } 041}