ao-tools/ao-dump-up: Document --wait flag
[fw/altos] / altosuilib / AltosUIDialog.java
1 /*
2  * Copyright © 2011 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  */
18
19 package org.altusmetrum.altosuilib_13;
20
21 import java.awt.*;
22 import java.awt.event.*;
23 import javax.swing.*;
24
25 class AltosUIDialogListener extends WindowAdapter {
26         public void windowClosing (WindowEvent e) {
27                 AltosUIPreferences.unregister_ui_listener((AltosUIDialog) e.getWindow());
28         }
29 }
30
31 public class AltosUIDialog extends JDialog implements AltosUIListener {
32
33         public void ui_changed(String look_and_feel) {
34                 SwingUtilities.updateComponentTreeUI(this);
35                 this.pack();
36         }
37
38         public AltosUIDialog() {
39                 AltosUIPreferences.register_ui_listener(this);
40                 addWindowListener(new AltosUIDialogListener());
41         }
42
43         public AltosUIDialog(Frame frame, String label, boolean modal) {
44                 super(frame, label, modal);
45                 AltosUIPreferences.register_ui_listener(this);
46                 addWindowListener(new AltosUIDialogListener());
47         }
48
49         public AltosUIDialog(Dialog dialog, String label, boolean modal) {
50                 super(dialog, label, modal);
51                 AltosUIPreferences.register_ui_listener(this);
52                 addWindowListener(new AltosUIDialogListener());
53         }
54
55         public AltosUIDialog(Frame frame, boolean modal) {
56                 super(frame, modal);
57                 AltosUIPreferences.register_ui_listener(this);
58                 addWindowListener(new AltosUIDialogListener());
59         }
60 }