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.base.dir;
17:
18: import net.sf.jftp.config.Settings;
19: import net.sf.jftp.gui.base.UITool;
20: import net.sf.jftp.gui.framework.*;
21: import net.sf.jftp.gui.tasks.PathChanger;
22:
23: import java.awt.*;
24: import java.awt.event.*;
25:
26: import javax.swing.*;
27: import javax.swing.event.*;
28:
29: public class DirCanvas extends JPanel implements MouseListener {
30: JLabel text = new JLabel(" ");
31: private Dir target;
32:
33: public DirCanvas(Dir target) {
34: this .target = target;
35: setLayout(new FlowLayout(FlowLayout.LEFT));
36: add(text);
37: addMouseListener(this );
38: setVisible(true);
39: }
40:
41: public void mouseClicked(MouseEvent e) {
42: if (target.getType().equals("local")) {
43: String tmp = UITool
44: .getPathFromDialog(Settings.defaultWorkDir);
45:
46: if (tmp != null) {
47: target.setPath(tmp);
48: target.fresh();
49: }
50: } else {
51: PathChanger p = new PathChanger("remote");
52: target.fresh();
53: }
54: }
55:
56: public void mousePressed(MouseEvent e) {
57: }
58:
59: public void mouseReleased(MouseEvent e) {
60: }
61:
62: public void mouseEntered(MouseEvent e) {
63: }
64:
65: public void mouseExited(MouseEvent e) {
66: }
67:
68: public void setText(String msg) {
69: text.setText(msg);
70: validate();
71: }
72:
73: public void paintComponent(Graphics g) {
74: g.setColor(GUIDefaults.light);
75: g.fillRect(0, 0, getSize().width, getSize().height);
76: g.setColor(GUIDefaults.front);
77: g.drawRect(0, 0, getSize().width - 1, getSize().height - 1);
78: g.drawRect(0, 0, getSize().width - 2, getSize().height - 2);
79: }
80: }
|