1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package wjhk.jupload2.gui.image;
23
24 import java.awt.BorderLayout;
25 import java.awt.Cursor;
26 import java.awt.Dimension;
27 import java.awt.Frame;
28 import java.awt.Toolkit;
29 import java.awt.event.ActionEvent;
30 import java.awt.event.ActionListener;
31 import java.awt.event.ComponentEvent;
32 import java.awt.event.ComponentListener;
33
34 import javax.swing.JButton;
35 import javax.swing.JDialog;
36
37 import wjhk.jupload2.filedata.PictureFileData;
38 import wjhk.jupload2.policies.UploadPolicy;
39
40
41
42
43
44
45 public class PictureDialog extends JDialog implements ActionListener,
46 ComponentListener {
47
48
49 private static final long serialVersionUID = 7802205907550854333L;
50
51 JButton buttonClose;
52
53 PictureFileData pictureFileData = null;
54
55 PicturePanel picturePanel = null;
56
57 UploadPolicy uploadPolicy = null;
58
59
60
61
62
63
64
65
66 public PictureDialog(Frame owner, PictureFileData pictureFileData,
67 UploadPolicy uploadPolicy) {
68 super(owner, pictureFileData.getFileName(), true);
69
70 this.uploadPolicy = uploadPolicy;
71 this.pictureFileData = pictureFileData;
72
73
74
75 setCursor(new Cursor(Cursor.WAIT_CURSOR));
76
77
78 this.picturePanel = new DialogPicturePanel(this, uploadPolicy,
79 pictureFileData);
80
81
82 this.buttonClose = new JButton(uploadPolicy
83 .getLocalizedString("buttonClose"));
84 this.buttonClose.setMaximumSize(new Dimension(100, 100));
85 this.buttonClose.addActionListener(this);
86
87 getContentPane().add(this.buttonClose, BorderLayout.SOUTH);
88 getContentPane().add(this.picturePanel);
89
90 pack();
91
92
93
94 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
95 setBounds(0, 0, screenSize.width, screenSize.height);
96
97
98
99
100
101 addComponentListener(this);
102 setVisible(true);
103
104
105
106
107
108
109
110
111 this.picturePanel.setPictureFile(null, null, null);
112 }
113
114
115
116
117 public void actionPerformed(ActionEvent event) {
118 if (event.getActionCommand() == this.buttonClose.getActionCommand()) {
119 this.uploadPolicy.displayDebug(
120 "[PictureDialog] Before this.dispose()", 10);
121 this.dispose();
122 }
123 }
124
125
126 public void componentHidden(ComponentEvent arg0) {
127
128 }
129
130
131 public void componentMoved(ComponentEvent arg0) {
132
133 }
134
135
136 public void componentResized(ComponentEvent arg0) {
137
138 }
139
140
141 public void componentShown(ComponentEvent arg0) {
142
143 setCursor(new Cursor(Cursor.HAND_CURSOR));
144 }
145
146 }