1 16 package net.sf.jftp.gui.framework; 17 18 import net.sf.jftp.*; 19 import net.sf.jftp.config.*; 20 21 import java.awt.*; 22 import java.awt.event.*; 23 import java.awt.image.*; 24 25 import javax.swing.*; 26 27 28 public class HDesktopBackground extends JPanel implements MouseListener, 29 ImageObserver 30 { 31 public ActionListener who = null; 32 private Image img; 33 private String image = null; 34 private String cmd = "default"; 35 36 public HDesktopBackground(String image, ActionListener who) 37 { 38 this.image = image; 39 this.who = who; 40 41 img = HImage.getImage(this, image); 42 addMouseListener(this); 43 setVisible(true); 44 } 45 46 public void paintComponent(Graphics g) 47 { 48 if(!Settings.getUseBackground()) 49 { 50 return; 51 } 52 53 int x = img.getWidth(this); 54 int y = img.getHeight(this); 55 int w = 2000 / x; 56 int h = 2000 / y; 57 58 for(int i = 0; i < w; i++) 59 { 60 for(int j = 0; j < h; j++) 61 { 62 g.drawImage(img, i * x, j * y, this); 63 } 64 } 65 } 66 67 public void update(Graphics g) 68 { 69 paintComponent(g); 70 } 71 72 public void mouseClicked(MouseEvent e) 73 { 74 } 75 76 public void mousePressed(MouseEvent e) 77 { 78 } 79 80 public void mouseReleased(MouseEvent e) 81 { 82 } 83 84 public void mouseEntered(MouseEvent e) 85 { 86 } 87 88 public void mouseExited(MouseEvent e) 89 { 90 } 91 92 public boolean imageUpdate(Image image, int infoflags, int x, int y, 93 int width, int height) 94 { 95 return true; 97 } 98 } 99 | Popular Tags |