JBDimension (Dimension size) { if (size instanceof JBDimension) { JBDimension newSize = ((JBDimension)size).newSize(); return size instanceof UIResource ? newSize.asUIResource() : newSize; } return new JBDimension(size.width, size.height); }