source: src/main/java/onetomany/etc/DrawImage.java@ 256

Last change on this file since 256 was 253, checked in by Faria Nassiri Mofakham, 5 years ago

Commit #1 of:
+ negotiator.onetomany package refactored into onetomany package.
+ info created for all contained the packages.
+ current work defined under onetomany.bargainingchipsgame.
+ in this package, onetomany.bargainingchipsgame.players package includes packages for utility function, coordinator, negotiatior, and buyer and seller.
+ negotiator.onetomany package now contains nothing, can be deleted.
+ Interaction thread

File size: 909 bytes
RevLine 
[253]1package onetomany.etc;
[216]2
3import java.awt.Canvas;
4import java.awt.Graphics;
[220]5import java.awt.Image;
6import java.awt.MediaTracker;
7import java.awt.Toolkit;
[216]8
9
[219]10/**
11 * @author Faria Nassiri-Mofakham
12 *
13 */
[226]14public class DrawImage extends Canvas{
[217]15
[219]16 /**
17 *
18 */
[220]19 private static final long serialVersionUID = 1L;
20 /**
21 *
22 */
[217]23
[220]24 Image image;
[217]25
[226]26 public DrawImage(String filename)
[219]27 {
[220]28 loadImage(filename);
[219]29 }
[220]30
[219]31 public void paint(Graphics g)
32 {
[220]33 g.drawImage(image, g.getClipBounds().x,g.getClipBounds().y, this);
[219]34 }
[217]35
[220]36 public void loadImage(String f)
37 {
38 MediaTracker tracker = new MediaTracker(this);
39 image = Toolkit.getDefaultToolkit().getImage(f);
40 tracker.addImage(image, 0);
41 try
42 {
43 tracker.waitForID(0);
44 }
45 catch(InterruptedException ie)
46 {
47 System.out.println(ie.getMessage());
48 }
49 }
[217]50}
[220]51
52
53
54
Note: See TracBrowser for help on using the repository browser.