1 11 package org.eclipse.jface.resource; 12 13 import org.eclipse.swt.graphics.Device; 14 import org.eclipse.swt.graphics.Font; 15 import org.eclipse.swt.graphics.FontData; 16 17 22 final class NamedFontDescriptor extends FontDescriptor { 23 24 private FontData data; 25 26 35 public NamedFontDescriptor(FontData data) { 36 this.data = data; 37 } 38 39 42 public Font createFont(Device device) { 43 return new Font(device, data); 44 } 45 46 49 public boolean equals(Object obj) { 50 if ((obj.getClass() == NamedFontDescriptor.class)) { 51 NamedFontDescriptor descr = (NamedFontDescriptor)obj; 52 53 return data.equals(descr.data); 54 } 55 56 return super.equals(obj); 57 } 58 59 62 public int hashCode() { 63 return data.hashCode(); 64 } 65 66 69 public void destroyFont(Font previouslyCreatedFont) { 70 previouslyCreatedFont.dispose(); 71 } 72 73 } 74 | Popular Tags |