Skip to content

Commit 7a6098f

Browse files
committed
Testing File save
1 parent fe08d80 commit 7a6098f

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

sources/net.sf.j2s.java.core/src/test/Test_Dialog2.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,45 @@ public void run() {
158158
});
159159
p.add(b);
160160

161+
b = new JButton("FileSaveDialog");
162+
b.addActionListener(new ActionListener() {
163+
164+
@Override
165+
public void actionPerformed(ActionEvent e) {
166+
AsyncFileChooser fc = new AsyncFileChooser();
167+
fc.showSaveDialog(Test_Dialog2.this, new Runnable() {
168+
169+
@Override
170+
public void run() {
171+
File file = fc.getSelectedFile();
172+
String msg = "FileChooser returned " + file;
173+
System.out.println(msg);
174+
status.setText(msg);
175+
}
176+
177+
}, null);
178+
}
179+
180+
});
181+
p.add(b);
182+
183+
b = new JButton("FileSaveDialog2");
184+
b.addActionListener(new ActionListener() {
185+
186+
@Override
187+
public void actionPerformed(ActionEvent e) {
188+
JFileChooser fc = new JFileChooser();
189+
int ret = fc.showSaveDialog(Test_Dialog2.this);
190+
File file = fc.getSelectedFile();
191+
String msg = "FileChooser returned " + ret + " " + file + (file == null ? "" : " path=" + file.getAbsolutePath());
192+
System.out.println(msg);
193+
status.setText(msg);
194+
}
195+
196+
});
197+
p.add(b);
198+
199+
161200
b = colorButton = new JButton("ColorDialog");
162201
b.addActionListener(new ActionListener() {
163202

0 commit comments

Comments
 (0)