Package com.explodingpixels.widgets

Source Code of com.explodingpixels.widgets.ImageBasedJComponent

package com.explodingpixels.widgets;

import com.explodingpixels.painter.ImagePainter;
import com.explodingpixels.swingx.EPPanel;

import java.awt.Dimension;
import java.awt.Image;

public class ImageBasedJComponent extends EPPanel {

    private final ImagePainter fPainter;

    public ImageBasedJComponent(Image image) {
        fPainter = new ImagePainter(image);
        setBackgroundPainter(fPainter);
    }

    @Override
    public Dimension getPreferredSize() {
        return new Dimension(fPainter.getImage().getWidth(null),
                fPainter.getImage().getHeight(null));
    }
}
TOP

Related Classes of com.explodingpixels.widgets.ImageBasedJComponent

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.