All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apidesign.html.canvas.impl.CnvsAccssr Maven / Gradle / Ivy

The newest version!
/**
 * Canvas API Copyright (C) 2013 AntonEpple 
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. Look for COPYING file in the top folder. If not, see
 * http://opensource.org/licenses/GPL-2.0.
 */
package org.apidesign.html.canvas.impl;

import java.util.logging.Level;
import java.util.logging.Logger;
import net.java.html.canvas.GraphicsContext2D;
import net.java.html.canvas.spi.GraphicsEnvironment;

/**
 *
 * @author antonepple
 */
public abstract class CnvsAccssr {

    static CnvsAccssr DEFAULT;

    public CnvsAccssr() {
        if (DEFAULT != null) {
            throw new IllegalStateException("Already initialized");
        }
        DEFAULT = this;
    }

    public static CnvsAccssr getDefault() {
        if (DEFAULT == null) {
            try {
                Class.forName(GraphicsContext2D.class.getName(), true, GraphicsContext2D.class.getClassLoader());
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(CnvsAccssr.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        return DEFAULT;
    }

    public abstract  GraphicsContext2D create(GraphicsEnvironment environment, Canvas c);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy