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

org.epics.pvmanager.sample.ImagePanel Maven / Gradle / Ivy

There is a newer version: 2.9.0
Show newest version
/**
 * Copyright (C) 2010-12 Brookhaven National Laboratory
 * All rights reserved. Use is subject to license terms.
 */
package org.epics.pvmanager.sample;

import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;

/**
 *
 * @author carcassi
 */
public class ImagePanel extends JPanel {

    private Image image;

    public void setImage(Image image) {
        this.image = image;
        repaint();
    }

    public Image getImage() {
        return image;
    }

    @Override
    protected void paintComponent(Graphics g) {
        if (image != null) {
            g.drawImage(image, 0, 0, getWidth(), getHeight(), this);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy