8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package sun.awt; 27 28 import java.awt.*; 29 import java.awt.dnd.*; 30 import java.awt.dnd.peer.DragSourceContextPeer; 31 import java.awt.event.*; 32 import java.awt.font.TextAttribute; 33 import java.awt.im.InputMethodHighlight; 34 import java.awt.image.*; 35 import java.awt.datatransfer.Clipboard; 36 import java.awt.peer.*; 37 import java.beans.PropertyChangeListener; 38 import java.net.URL; 39 import java.util.Map; 40 import java.util.Properties; 41 42 public class HeadlessToolkit extends Toolkit 43 implements ComponentFactory, KeyboardFocusManagerPeerProvider { 44 45 private static final KeyboardFocusManagerPeer kfmPeer = new KeyboardFocusManagerPeer() { 46 public void setCurrentFocusedWindow(Window win) {} 47 public Window getCurrentFocusedWindow() { return null; } 385 public Image createImage(ImageProducer producer) { 386 return tk.createImage(producer); 387 } 388 389 public Image createImage(byte[] imagedata) { 390 return tk.createImage(imagedata); 391 } 392 393 394 /* 395 * Fonts 396 */ 397 @SuppressWarnings("deprecation") 398 public FontPeer getFontPeer(String name, int style) { 399 if (componentFactory != null) { 400 return componentFactory.getFontPeer(name, style); 401 } 402 return null; 403 } 404 405 @SuppressWarnings("deprecation") 406 public FontMetrics getFontMetrics(Font font) { 407 return tk.getFontMetrics(font); 408 } 409 410 @SuppressWarnings("deprecation") 411 public String[] getFontList() { 412 return tk.getFontList(); 413 } 414 415 /* 416 * Desktop properties 417 */ 418 419 public void addPropertyChangeListener(String name, 420 PropertyChangeListener pcl) { 421 tk.addPropertyChangeListener(name, pcl); 422 } 423 424 public void removePropertyChangeListener(String name, | 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package sun.awt; 27 28 import sun.awt.datatransfer.DataTransferer; 29 30 import java.awt.*; 31 import java.awt.dnd.*; 32 import java.awt.dnd.peer.DragSourceContextPeer; 33 import java.awt.event.*; 34 import java.awt.font.TextAttribute; 35 import java.awt.im.InputMethodHighlight; 36 import java.awt.image.*; 37 import java.awt.datatransfer.Clipboard; 38 import java.awt.peer.*; 39 import java.beans.PropertyChangeListener; 40 import java.net.URL; 41 import java.util.Map; 42 import java.util.Properties; 43 44 public class HeadlessToolkit extends Toolkit 45 implements ComponentFactory, KeyboardFocusManagerPeerProvider { 46 47 private static final KeyboardFocusManagerPeer kfmPeer = new KeyboardFocusManagerPeer() { 48 public void setCurrentFocusedWindow(Window win) {} 49 public Window getCurrentFocusedWindow() { return null; } 387 public Image createImage(ImageProducer producer) { 388 return tk.createImage(producer); 389 } 390 391 public Image createImage(byte[] imagedata) { 392 return tk.createImage(imagedata); 393 } 394 395 396 /* 397 * Fonts 398 */ 399 @SuppressWarnings("deprecation") 400 public FontPeer getFontPeer(String name, int style) { 401 if (componentFactory != null) { 402 return componentFactory.getFontPeer(name, style); 403 } 404 return null; 405 } 406 407 @Override 408 public DataTransferer getDataTransferer() { 409 return null; 410 } 411 412 @SuppressWarnings("deprecation") 413 public FontMetrics getFontMetrics(Font font) { 414 return tk.getFontMetrics(font); 415 } 416 417 @SuppressWarnings("deprecation") 418 public String[] getFontList() { 419 return tk.getFontList(); 420 } 421 422 /* 423 * Desktop properties 424 */ 425 426 public void addPropertyChangeListener(String name, 427 PropertyChangeListener pcl) { 428 tk.addPropertyChangeListener(name, pcl); 429 } 430 431 public void removePropertyChangeListener(String name, |