00324 {
00325
00326 JFileChooser chooser =
new JFileChooser(outputFile);
00327 chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
00328 chooser.setApproveButtonText(
"Export");
00329 chooser.setApproveButtonMnemonic(
's');
00330 chooser.setApproveButtonToolTipText(actionToolTipText);
00331 chooser.setDialogTitle(
"Choose the file name");
00332
00333
if (chooser.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION)
00334 {
00335
outputFile = chooser.getSelectedFile();
00336
if (
outputFile != null)
00337 {
00338
00339
try
00340 {
00341 PrintStream out =
new PrintStream(
new FileOutputStream(outputFile));
00342
int columnNumber, rowNumber;
00343 columnNumber = sorter.getColumnCount();
00344 rowNumber = sorter.getRowCount();
00345
for (
int i = 0; i < rowNumber; i++)
00346 {
00347
for (
int j = 0; j < columnNumber; j++)
00348 {
00349 out.print(sorter.getValueAt(i, j));
00350 out.print(SEPARATOR);
00351 }
00352 out.println();
00353 }
00354 out.close();
00355 }
00356
catch (Exception ex)
00357 {
00358 JOptionPane.showMessageDialog(frame, Translate.get(
00359 actionErrorMessage, ex),
"Unexpected Error",
00360 JOptionPane.ERROR_MESSAGE);
00361
return;
00362 }
00363 JOptionPane.showMessageDialog(frame, Translate.get(
00364 actionSuccessMessage, outputFile),
"Action Performed",
00365 JOptionPane.INFORMATION_MESSAGE);
00366 }
00367 }
00368 }