All pastes #423545 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-04 08:11 UTC
rendered paste body
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
import java.io.*;
import java.net.*;
import javax.imageio.*;

/** 
 * This class automatically generates a random card and draws the image.
 * 
 * @author Bill Kukowski
 */ 

public class DrawCard {
	
	public static void main(String[] args) {

		Card card1 = new Card();
		card1.generate();	
		
		try {
		File outputFile = new File(card1.getPath());
		
          JDialog window = new JDialog();

          Container windowContent = window.getContentPane();

          BufferedImage newImage = ImageIO.read(outputFile);

          JLabel label = new JLabel(new ImageIcon(newImage));

          JScrollPane pane = new JScrollPane(label);

          windowContent.add(pane, BorderLayout.CENTER);

          window.setSize(160, 245);
          window.show();

			}

		   catch (MalformedURLException mur) {
            System.err.println("Bad filename");
          } catch (IOException ioe) {
            System.err.println("Error reading file");
		}
	}
}