new disk list image

This commit is contained in:
Denis Molony 2021-05-22 09:59:06 +10:00
parent 9dddd2be3e
commit b45e7d7e54
5 changed files with 22 additions and 52 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 784 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -120,7 +120,7 @@ public class DisksWindow extends JFrame
}
});
scrollPane.setPreferredSize (new Dimension (1200, 700));
scrollPane.setPreferredSize (new Dimension (1200, 693));
setDefaultCloseOperation (HIDE_ON_CLOSE);
deleteWindow = new DeleteWindow (rootFolderData);

View File

@ -43,55 +43,26 @@ public abstract class AbstractSaveAction extends DefaultAction
void saveBuffer (byte[] buffer)
// ---------------------------------------------------------------------------------//
{
if (fileChooser.showSaveDialog (null) == JFileChooser.APPROVE_OPTION)
if (fileChooser.showSaveDialog (null) != JFileChooser.APPROVE_OPTION)
return;
File file = fileChooser.getSelectedFile ();
try
{
File file = fileChooser.getSelectedFile ();
try
{
Files.write (file.toPath (), buffer, StandardOpenOption.CREATE_NEW);
JOptionPane.showMessageDialog (null,
String.format ("File %s saved", file.getName ()));
}
catch (FileAlreadyExistsException e)
{
JOptionPane.showMessageDialog (null,
"File " + file.getName () + " already exists", "Failed",
JOptionPane.ERROR_MESSAGE);
}
catch (IOException e)
{
e.printStackTrace ();
JOptionPane.showMessageDialog (null, "File failed to save - " + e.getMessage (),
"Failed", JOptionPane.ERROR_MESSAGE);
}
Files.write (file.toPath (), buffer, StandardOpenOption.CREATE_NEW);
JOptionPane.showMessageDialog (null,
String.format ("File %s saved", file.getName ()));
}
catch (FileAlreadyExistsException e)
{
JOptionPane.showMessageDialog (null, "File " + file.getName () + " already exists",
"Failed", JOptionPane.ERROR_MESSAGE);
}
catch (IOException e)
{
e.printStackTrace ();
JOptionPane.showMessageDialog (null, "File failed to save - " + e.getMessage (),
"Failed", JOptionPane.ERROR_MESSAGE);
}
}
// ---------------------------------------------------------------------------------//
// void saveFile (Path sourcePath)
// // ---------------------------------------------------------------------------------//
// {
// if (fileChooser.showSaveDialog (null) == JFileChooser.APPROVE_OPTION)
// {
// File file = fileChooser.getSelectedFile ();
// try
// {
// Files.copy (sourcePath, file.toPath ());
// JOptionPane.showMessageDialog (null,
// String.format ("File %s saved", file.getName ()));
// }
// catch (FileAlreadyExistsException e)
// {
// JOptionPane.showMessageDialog (null,
// "File " + file.getName () + " already exists", "Failed",
// JOptionPane.ERROR_MESSAGE);
// }
// catch (IOException e)
// {
// e.printStackTrace ();
// JOptionPane.showMessageDialog (null, "File failed to save - " + e.getMessage (),
// "Failed", JOptionPane.ERROR_MESSAGE);
// }
// }
// }
}

View File

@ -40,11 +40,10 @@ class SaveDiskAction extends AbstractSaveAction implements DiskSelectionListener
String suffix = blocks <= 560 ? ".dsk" : ".hdv";
setSelectedFile (new File (formattedDisk.getName () + suffix));
// saveFile (disk.getFile ().toPath ());
saveBuffer (appleDisk.getBuffer ());
}
else
System.out.println ("Not an AppleDisk");
System.out.println ("Not an AppleDisk"); // impossible
}
// ---------------------------------------------------------------------------------//

View File

@ -34,7 +34,7 @@ public final class Utility
public static final byte ASCII_CARET = 0x5E;
private static final List<String> suffixes = Arrays.asList ("po", "dsk", "do", "hdv",
"2mg", "v2d", "d13", "sdk", "shk", "bxy", "bny", "woz", "img", "dimg");
"2mg", "d13", "sdk", "shk", "bxy", "bny", "woz", "img", "dimg");
// ---------------------------------------------------------------------------------//
private Utility ()