mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-19 12:30:27 +00:00
new disk list image
This commit is contained in:
parent
9dddd2be3e
commit
b45e7d7e54
Binary file not shown.
Before Width: | Height: | Size: 784 KiB After Width: | Height: | Size: 1.1 MiB |
@ -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);
|
setDefaultCloseOperation (HIDE_ON_CLOSE);
|
||||||
|
|
||||||
deleteWindow = new DeleteWindow (rootFolderData);
|
deleteWindow = new DeleteWindow (rootFolderData);
|
||||||
|
@ -43,55 +43,26 @@ public abstract class AbstractSaveAction extends DefaultAction
|
|||||||
void saveBuffer (byte[] buffer)
|
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 ();
|
Files.write (file.toPath (), buffer, StandardOpenOption.CREATE_NEW);
|
||||||
try
|
JOptionPane.showMessageDialog (null,
|
||||||
{
|
String.format ("File %s saved", file.getName ()));
|
||||||
Files.write (file.toPath (), buffer, StandardOpenOption.CREATE_NEW);
|
}
|
||||||
JOptionPane.showMessageDialog (null,
|
catch (FileAlreadyExistsException e)
|
||||||
String.format ("File %s saved", file.getName ()));
|
{
|
||||||
}
|
JOptionPane.showMessageDialog (null, "File " + file.getName () + " already exists",
|
||||||
catch (FileAlreadyExistsException e)
|
"Failed", JOptionPane.ERROR_MESSAGE);
|
||||||
{
|
}
|
||||||
JOptionPane.showMessageDialog (null,
|
catch (IOException e)
|
||||||
"File " + file.getName () + " already exists", "Failed",
|
{
|
||||||
JOptionPane.ERROR_MESSAGE);
|
e.printStackTrace ();
|
||||||
}
|
JOptionPane.showMessageDialog (null, "File failed to save - " + e.getMessage (),
|
||||||
catch (IOException e)
|
"Failed", JOptionPane.ERROR_MESSAGE);
|
||||||
{
|
|
||||||
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);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,10 @@ class SaveDiskAction extends AbstractSaveAction implements DiskSelectionListener
|
|||||||
String suffix = blocks <= 560 ? ".dsk" : ".hdv";
|
String suffix = blocks <= 560 ? ".dsk" : ".hdv";
|
||||||
|
|
||||||
setSelectedFile (new File (formattedDisk.getName () + suffix));
|
setSelectedFile (new File (formattedDisk.getName () + suffix));
|
||||||
// saveFile (disk.getFile ().toPath ());
|
|
||||||
saveBuffer (appleDisk.getBuffer ());
|
saveBuffer (appleDisk.getBuffer ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
System.out.println ("Not an AppleDisk");
|
System.out.println ("Not an AppleDisk"); // impossible
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
|
@ -34,7 +34,7 @@ public final class Utility
|
|||||||
public static final byte ASCII_CARET = 0x5E;
|
public static final byte ASCII_CARET = 0x5E;
|
||||||
|
|
||||||
private static final List<String> suffixes = Arrays.asList ("po", "dsk", "do", "hdv",
|
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 ()
|
private Utility ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user