update ChangeLog for 1.9.17 release
[fw/altos] / micropeak / MicroFrame.java
index a9b9a37a2ea6d1f346b06ebca1d0f37b08637954..ec99c64274ec6dd38e6c7eba5b44348741138736 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -21,54 +22,17 @@ import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 import java.util.*;
-
-class MicroFrameListener extends WindowAdapter {
-       public void windowClosing (WindowEvent e) {
-               MicroPreferences.unregister_ui_listener((MicroFrame) e.getWindow());
-       }
-}
-
-public class MicroFrame extends JFrame implements MicroUIListener {
-
-       public void ui_changed(String look_and_feel) {
-               SwingUtilities.updateComponentTreeUI(this);
-               this.pack();
-       }
-
-       static final String[] icon_names = {
-               "/micropeak-16.png",
-               "/micropeak-32.png",
-               "/micropeak-48.png",
-               "/micropeak-64.png",
-               "/micropeak-128.png",
-               "/micropeak-256.png"
+import org.altusmetrum.altosuilib_14.*;
+
+public class MicroFrame extends AltosUIFrame {
+       static String[] micro_icon_names = {
+               "/altusmetrum-micropeak-16.png",
+               "/altusmetrum-micropeak-32.png",
+               "/altusmetrum-micropeak-48.png",
+               "/altusmetrum-micropeak-64.png",
+               "/altusmetrum-micropeak-128.png",
+               "/altusmetrum-micropeak-256.png"
        };
 
-       public void set_icon() {
-               ArrayList<Image> icons = new ArrayList<Image>();
-               
-               for (int i = 0; i < icon_names.length; i++) {
-                       java.net.URL imgURL = MicroPeak.class.getResource(icon_names[i]);
-                       if (imgURL != null)
-                               icons.add(new ImageIcon(imgURL).getImage());
-               }
-
-               setIconImages(icons);
-       }
-                       
-       public MicroFrame() {
-               super();
-               MicroPreferences.set_component(this);
-               MicroPreferences.register_ui_listener(this);
-               addWindowListener(new MicroFrameListener());
-               set_icon();
-       }
-
-       public MicroFrame(String name) {
-               super(name);
-               MicroPreferences.set_component(this);
-               MicroPreferences.register_ui_listener(this);
-               addWindowListener(new MicroFrameListener());
-               set_icon();
-       }
+       static { set_icon_names(micro_icon_names); }
 }