diff options
author | Keith Packard <keithp@keithp.com> | 2013-03-24 16:15:21 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-05-07 20:16:52 -0700 |
commit | 9df4e874b2785aec4aecce2f767543ee9f638b4f (patch) | |
tree | c189d613432317368646b48246bb82bd9f401ef6 /altosui/AltosFlashUI.java | |
parent | 09e0c304b420a12fa1616005db946523c6e5bef1 (diff) |
altosui/altoslib: Move more flashing code from altosui to altoslib
Required a bit of refactoring to eliminate swing types from the
flashing code, but nothing major.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosFlashUI.java')
-rw-r--r-- | altosui/AltosFlashUI.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/altosui/AltosFlashUI.java b/altosui/AltosFlashUI.java index e5176278..f4e52218 100644 --- a/altosui/AltosFlashUI.java +++ b/altosui/AltosFlashUI.java @@ -215,15 +215,30 @@ public class AltosFlashUI } } - class flash_task implements Runnable { + class flash_task implements Runnable, AltosFlashListener { AltosFlashUI ui; Thread t; AltosFlash flash; + public void position(String in_s, int in_percent) { + final String s = in_s; + final int percent = in_percent; + Runnable r = new Runnable() { + public void run() { + try { + ui.actionPerformed(new ActionEvent(this, + percent, + s)); + } catch (Exception ex) { + } + } + }; + SwingUtilities.invokeLater(r); + } + public void run () { try { - flash = new AltosFlash(ui.file, ui.debug_dongle); - flash.addActionListener(ui); + flash = new AltosFlash(ui.file, new AltosSerial(ui.debug_dongle), this); final AltosRomconfig current_config = flash.romconfig(); |