1 11 package org.eclipse.jface.resource; 12 13 import org.eclipse.swt.graphics.Color; 14 import org.eclipse.swt.graphics.Device; 15 import org.eclipse.swt.graphics.RGB; 16 17 24 public abstract class ColorDescriptor extends DeviceResourceDescriptor { 25 26 41 public static ColorDescriptor createFrom(Color toCreate, Device originalDevice) { 42 return new RGBColorDescriptor(toCreate); 43 } 44 45 57 public static ColorDescriptor createFrom(Color toCreate) { 58 return new RGBColorDescriptor(toCreate); 59 } 60 61 68 public static ColorDescriptor createFrom(RGB toCreate) { 69 return new RGBColorDescriptor(toCreate); 70 } 71 72 79 public abstract Color createColor(Device device) throws DeviceResourceException; 80 81 88 public abstract void destroyColor(Color toDestroy); 89 90 93 public final Object createResource(Device device) throws DeviceResourceException { 94 return createColor(device); 95 } 96 97 100 public final void destroyResource(Object previouslyCreatedObject) { 101 destroyColor((Color)previouslyCreatedObject); 102 } 103 } 104 | Popular Tags |