01: /*
02: * This program is free software; you can redistribute it and/or
03: * modify it under the terms of the GNU General Public License
04: * as published by the Free Software Foundation; either version 2
05: * of the License, or (at your option) any later version.
06: *
07: * This program is distributed in the hope that it will be useful,
08: * but WITHOUT ANY WARRANTY; without even the implied warranty of
09: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10: * GNU General Public License for more details.
11:
12: * You should have received a copy of the GNU General Public License
13: * along with this program; if not, write to the Free Software
14: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15: */
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: public class HDesktopBackground extends JPanel implements
28: MouseListener, ImageObserver {
29: public ActionListener who = null;
30: private Image img;
31: private String image = null;
32: private String cmd = "default";
33:
34: public HDesktopBackground(String image, ActionListener who) {
35: this .image = image;
36: this .who = who;
37:
38: img = HImage.getImage(this , image);
39: addMouseListener(this );
40: setVisible(true);
41: }
42:
43: public void paintComponent(Graphics g) {
44: if (!Settings.getUseBackground()) {
45: return;
46: }
47:
48: int x = img.getWidth(this );
49: int y = img.getHeight(this );
50: int w = 2000 / x;
51: int h = 2000 / y;
52:
53: for (int i = 0; i < w; i++) {
54: for (int j = 0; j < h; j++) {
55: g.drawImage(img, i * x, j * y, this );
56: }
57: }
58: }
59:
60: public void update(Graphics g) {
61: paintComponent(g);
62: }
63:
64: public void mouseClicked(MouseEvent e) {
65: }
66:
67: public void mousePressed(MouseEvent e) {
68: }
69:
70: public void mouseReleased(MouseEvent e) {
71: }
72:
73: public void mouseEntered(MouseEvent e) {
74: }
75:
76: public void mouseExited(MouseEvent e) {
77: }
78:
79: public boolean imageUpdate(Image image, int infoflags, int x,
80: int y, int width, int height) {
81: //if(width > 0 && height >0) repaint();
82: return true;
83: }
84: }
|