//# 0 errors, 18 messages
//#
/*
    //#FontPicker.java:1:1: class: com.dmdirc.addons.ui_swing.components.FontPicker
    //#FontPicker.java:1:1: method: com.dmdirc.addons.ui_swing.components.FontPicker.com.dmdirc.addons.ui_swing.components.FontPicker__static_init
 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.dmdirc.addons.ui_swing.components;

import com.dmdirc.addons.ui_swing.components.renderers.FontListCellRenderer;

import java.awt.Font;
import java.awt.GraphicsEnvironment;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;

/**
 * System font picking component.
 */
public class FontPicker extends JComboBox {

    private static final long serialVersionUID = -9054812588033935839L;

    public FontPicker(final String fontFamily) {
        super(new DefaultComboBoxModel());
    //#FontPicker.java:40: method: void com.dmdirc.addons.ui_swing.components.FontPicker.com.dmdirc.addons.ui_swing.components.FontPicker(String)
    //#input(void com.dmdirc.addons.ui_swing.components.FontPicker(String)): this
    //#presumption(void com.dmdirc.addons.ui_swing.components.FontPicker(String)): arr$.length@42 <= 4_294_967_295
    //#presumption(void com.dmdirc.addons.ui_swing.components.FontPicker(String)): com.dmdirc.addons.ui_swing.components.FontPicker:getFont(...)@43 != null
    //#presumption(void com.dmdirc.addons.ui_swing.components.FontPicker(String)): com.dmdirc.addons.ui_swing.components.FontPicker:getModel(...)@45 != null
    //#presumption(void com.dmdirc.addons.ui_swing.components.FontPicker(String)): java.awt.GraphicsEnvironment:getAvailableFontFamilyNames(...)@42 != null
    //#presumption(void com.dmdirc.addons.ui_swing.components.FontPicker(String)): java.awt.GraphicsEnvironment:getLocalGraphicsEnvironment(...)@42 != null

        final String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
        final int size = getFont().getSize();
    //#FontPicker.java:43: Warning: method not available - call not analyzed
    //#    call on Font com.dmdirc.addons.ui_swing.components.FontPicker:getFont()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.FontPicker
    //#    method: void com.dmdirc.addons.ui_swing.components.FontPicker(String)
    //#    unanalyzed callee: Font com.dmdirc.addons.ui_swing.components.FontPicker:getFont()
        for (String font : fonts) {
            ((DefaultComboBoxModel) getModel()).addElement(new Font(font, Font.PLAIN, size));
    //#FontPicker.java:45: Warning: method not available - call not analyzed
    //#    call on ComboBoxModel com.dmdirc.addons.ui_swing.components.FontPicker:getModel()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.FontPicker
    //#    method: void com.dmdirc.addons.ui_swing.components.FontPicker(String)
    //#    unanalyzed callee: ComboBoxModel com.dmdirc.addons.ui_swing.components.FontPicker:getModel()
        }

        setRenderer(new FontListCellRenderer());
    //#FontPicker.java:48: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.renderers.FontListCellRenderer()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.FontPicker
    //#    method: void com.dmdirc.addons.ui_swing.components.FontPicker(String)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.renderers.FontListCellRenderer()
    //#FontPicker.java:48: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.addons.ui_swing.components.FontPicker:setRenderer(ListCellRenderer)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.ui_swing.components.FontPicker
    //#    method: void com.dmdirc.addons.ui_swing.components.FontPicker(String)
    //#    unanalyzed callee: void com.dmdirc.addons.ui_swing.components.FontPicker:setRenderer(ListCellRenderer)
    }
    //#FontPicker.java:49: end of method: void com.dmdirc.addons.ui_swing.components.FontPicker.com.dmdirc.addons.ui_swing.components.FontPicker(String)
}    //#output(com.dmdirc.addons.ui_swing.components.FontPicker__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/components/FontPicker]
    //#post(com.dmdirc.addons.ui_swing.components.FontPicker__static_init): __Descendant_Table[com/dmdirc/addons/ui_swing/components/FontPicker] == &__Dispatch_Table
    //#FontPicker.java:: end of method: com.dmdirc.addons.ui_swing.components.FontPicker.com.dmdirc.addons.ui_swing.components.FontPicker__static_init
    //#FontPicker.java:: end of class: com.dmdirc.addons.ui_swing.components.FontPicker
