<commit_before>//
// $Id: LabelSprite.java,v 1.1 2002/03/16 03:15:05 shaper Exp $

package com.threerings.media.sprite;

import java.awt.Dimension;
import java.awt.Graphics2D;

import com.samskivert.swing.Label;

import com.threerings.media.Log;

/**
 * A sprite that uses a label to render itself.  Assumes that the label
 * has been previously laid out (see {@link Label#layout}).  The label
 * should not be altered after the sprite is created.
 */
public class LabelSprite extends Sprite
{
    /**
     * Constructs a label sprite that renders itself with the specified
     * label.
     */
    public LabelSprite (Label label)
    {
        this(0, 0, label);
    }

    /**
     * Constructs a label sprite with the given initial position that
     * renders itself with the specified label.
     */
    public LabelSprite (int x, int y, Label label)
    {
        super(x, y);

        _label = label;
    }

    // documentation inherited
    protected void init (SpriteManager spritemgr)
    {
        super.init(spritemgr);

        // size the bounds to fit our label
        Dimension size = _label.getSize();
        _bounds.width = size.width;
        _bounds.height = size.height;
    }

    // documentation inherited
    public void paint (Graphics2D gfx)
    {
        _label.render(gfx, _bounds.x, _bounds.y);
    }

    /** The label associated with this sprite. */
    protected Label _label;
}<commit_msg>Added getLabel().<commit_after>//
// $Id: LabelSprite.java,v 1.2 2002/06/20 09:01:28 shaper Exp $

package com.threerings.media.sprite;

import java.awt.Dimension;
import java.awt.Graphics2D;

import com.samskivert.swing.Label;

import com.threerings.media.Log;

/**
 * A sprite that uses a label to render itself.  Assumes that the label
 * has been previously laid out (see {@link Label#layout}).  The label
 * should not be altered after the sprite is created.
 */
public class LabelSprite extends Sprite
{
    /**
     * Constructs a label sprite that renders itself with the specified
     * label.
     */
    public LabelSprite (Label label)
    {
        this(0, 0, label);
    }

    /**
     * Constructs a label sprite with the given initial position that
     * renders itself with the specified label.
     */
    public LabelSprite (int x, int y, Label label)
    {
        super(x, y);

        _label = label;
    }

    /**
     * Returns the label displayed by this sprite.
     */
    public Label getLabel ()
    {
        return _label;
    }

    // documentation inherited
    protected void init (SpriteManager spritemgr)
    {
        super.init(spritemgr);

        // size the bounds to fit our label
        Dimension size = _label.getSize();
        _bounds.width = size.width;
        _bounds.height = size.height;
    }

    // documentation inherited
    public void paint (Graphics2D gfx)
    {
        _label.render(gfx, _bounds.x, _bounds.y);
    }

    /** The label associated with this sprite. */
    protected Label _label;
}
{'fraction_non_alphanumeric': 0.09659090909090909, 'fraction_numerical': 0.013368983957219251, 'mean_word_length': 2.3591470258136926, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5007691', 'n_tokens_mistral': 928, 'n_tokens_neox': 890, 'n_words': 297}