X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=micropeak%2FMicroPeak.java;h=8bdf4b775fc0d08b457348053e775267f777a984;hp=792231768808a04011246d2561c29b637bffb8ef;hb=7767a045d446ea2bc5fe1ec98d89274155f956c4;hpb=09d5d6f546ccef2bfd4941e590f047485bb73d76 diff --git a/micropeak/MicroPeak.java b/micropeak/MicroPeak.java index 79223176..8bdf4b77 100644 --- a/micropeak/MicroPeak.java +++ b/micropeak/MicroPeak.java @@ -23,8 +23,8 @@ import javax.swing.*; import java.io.*; import java.util.concurrent.*; import java.util.*; -import org.altusmetrum.altoslib_1.*; -import org.altusmetrum.altosuilib_1.*; +import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altosuilib_3.*; public class MicroPeak extends MicroFrame implements ActionListener, ItemListener { @@ -65,6 +65,10 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene try { data = new MicroData((InputStream) fis, filename.getName()); AltosUIPreferences.set_last_logdir(filename); + } catch (MicroData.NonHexcharException nhe) { + data = null; + } catch (MicroData.FileEndedException nhe) { + data = null; } catch (InterruptedException ie) { data = null; } finally { @@ -186,10 +190,25 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene public void itemStateChanged(ItemEvent e) { } + /* OSXAdapter interfaces */ + public void macosx_file_handler(String path) { + CommandGraph(new File(path)); + } + + public void macosx_quit_handler() { + System.exit(0); + } + + public void macosx_preferences_handler() { + Preferences(); + } + public MicroPeak() { ++number_of_windows; + register_for_macosx_events(); + AltosUIPreferences.set_component(this); container = getContentPane(); @@ -231,6 +250,10 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene fileMenu.add(exitAction); exitAction.addActionListener(this); + JButton downloadButton = new JButton ("Download"); + downloadButton.addActionListener(this); + menuBar.add(downloadButton); + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override