X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=micropeak%2FMicroFrame.java;h=8129aedbd621f71fa5c38570ccf22a85056c1a9c;hp=a9b9a37a2ea6d1f346b06ebca1d0f37b08637954;hb=refs%2Fheads%2Fbranch-1.9;hpb=daf8776f8646ba187f1a17f7aae797503bed3f2a diff --git a/micropeak/MicroFrame.java b/micropeak/MicroFrame.java index a9b9a37a..ec99c642 100644 --- a/micropeak/MicroFrame.java +++ b/micropeak/MicroFrame.java @@ -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 icons = new ArrayList(); - - 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); } }