draw Image On Panel - Java 2D Graphics

Java examples for 2D Graphics:Image

Description

draw Image On Panel

Demo Code


//package com.java2s;

import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;

public class Main {
    public static void drawImageOnPanel(JPanel pane, BufferedImage img) {
        Graphics g = pane.getGraphics();
        g.drawImage(img, 0, 0, pane.getWidth(), pane.getHeight(),
                Color.WHITE, null);
    }// www  .j a  v a2  s .  co m
}

Related Tutorials