[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: extended peers
From: |
Sascha Brawer |
Subject: |
Re: extended peers |
Date: |
Fri, 12 Sep 2003 15:29:21 +0200 |
Brian Jones <address@hidden> wrote on Fri, 12 Sep 2003 08:58:29 -0400:
>Sascha Brawer <address@hidden> writes:
>
>> package java.awt;
>>
>> import java.awt.Toolkit;
>> import gnu.java.awt.ClasspathToolkit;
>>
>> public abstract class GraphicsEnvironment
>> {
>> private static GraphicsEnvironment localGraphicsEnvironment;
>>
>> public static synchronized getLocalGraphicsEnvironment()
>> {
>> if (localGraphicsEnvironment == null)
>> {
>> ClasspathToolkit ctk;
>>
>> ctk = (ClasspathToolkit) Toolkit.getDefaultToolkit();
>> localGraphicsEnvironment = ctk.getLocalGraphicsEnvironment();
>> }
>>
>> return localGraphicsEnvironment;
>> }
>> }
>
>I think you can store the reference as a Toolkit only. What parts of
>our code would rely upon having a ClasspathToolkit with the additional
>Font related stuff?
You mean "storing" in the local variable ctk? One also could write
localGraphicsEnvironment =
((ClasspathToolkit) Toolkit.getDefaultToolkit())
.getLocalGraphicsEnvironment();
but this seems a bit less legible. The cast is needed because the method
to create a concrete GraphicsEnvironment is introduced by
ClasspathToolkit, not by Toolkit.
-- Sascha
Sascha Brawer, address@hidden, http://www.dandelis.ch/people/brawer/
- extended peers, graydon hoare, 2003/09/10
- Re: extended peers, Sascha Brawer, 2003/09/10
- Re: extended peers, Dalibor Topic, 2003/09/10
- Re: extended peers, Brian Jones, 2003/09/11
- Re: extended peers, Brian Jones, 2003/09/12
- Re: extended peers,
Sascha Brawer <=
- Re: extended peers, Sascha Brawer, 2003/09/14
- Re: extended peers, graydon hoare, 2003/09/16
- Re: extended peers, Sascha Brawer, 2003/09/17
- Re: extended peers, graydon hoare, 2003/09/17
- Re: extended peers, Sascha Brawer, 2003/09/18
Re: extended peers, Thomas Fitzsimmons, 2003/09/10