Handle hostnames with upper-case letters
[webmin.git] / file / FixedFrame.java
1 import java.awt.*;
2 import java.io.*;
3
4 public class FixedFrame extends Frame
5 {
6         int mw = 0, mh = 0;
7
8         public FixedFrame()
9         {
10         Dimension d = Util.tk.getScreenSize();
11         double rx = Math.random(), ry = Math.random();
12         move((int)((d.width/2)*rx), (int)((d.height/2)*ry));
13         }
14
15         public FixedFrame(int w, int h)
16         {
17         this();
18         mw = w; mh = h;
19         }
20
21         public boolean handleEvent(Event evt)
22         {
23         if (evt.target == this && evt.id == Event.WINDOW_DESTROY) {
24                 dispose();
25                 return true;
26                 }
27         return super.handleEvent(evt);
28         }
29
30         public Dimension minimumSize()
31         {
32         if (mw != 0 && mh != 0) return new Dimension(mw, mh);
33         else return super.minimumSize();
34         }
35
36         public Dimension preferredSize()
37         {
38         return minimumSize();
39         }
40
41         public void setFixedSize(int w, int h)
42         {
43         mw = w; mh = h;
44         }
45 }
46