OSPDialog is a standard dialog that can remain hidden in applet mode. Copyright: Copyright (c) 2002 @author Wolfgang Christian @version 1.0
| 21 | * @version 1.0 |
| 22 | */ |
| 23 | public class OSPDialog extends JDialog { |
| 24 | static int topx = 10; |
| 25 | static int topy = 100; |
| 26 | |
| 27 | /** Set <I>true</I> if the program is an applet. */ |
| 28 | public static boolean appletMode = false; |
| 29 | |
| 30 | /** Field myApplet provides a static reference to an applet context |
| 31 | * so that the document base and code base can be obtained in applet mode. |
| 32 | */ |
| 33 | public static JApplet applet; |
| 34 | |
| 35 | /** The thread group that created this object.*/ |
| 36 | public ThreadGroup constructorThreadGroup = Thread.currentThread().getThreadGroup(); |
| 37 | protected boolean keepHidden = false; |
| 38 | protected BufferStrategy strategy; |
| 39 | |
| 40 | /** |
| 41 | * Constricts a dialog that can be kept hidden in applets. |
| 42 | * |
| 43 | * @param owner Dialog |
| 44 | * @param title String |
| 45 | * @param modal boolean |
| 46 | */ |
| 47 | public OSPDialog(Frame owner, String title, boolean modal) { |
| 48 | super(owner, title, modal); |
| 49 | if(appletMode) { |
| 50 | keepHidden = true; |
| 51 | } |
| 52 | setLocation(topx, topy); |
| 53 | Dimension d = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); |
| 54 | topx = Math.min(topx+20, (int) d.getWidth()-100); |
| 55 | topy = Math.min(topy+20, (int) d.getHeight()-100); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * OSPDialog constructor with a title. |
| 60 | * @param title |
| 61 | */ |
| 62 | public OSPDialog(String title) { |
| 63 | this(null, title, false); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * OSPDialog constructor. |
| 68 | */ |
| 69 | public OSPDialog() { |
| 70 | this(""); //$NON-NLS-1$ |
| 71 | } |
| 72 | |
| 73 | @Override |
| 74 | public void setSize(int width, int height) { |
| 75 | super.setSize(width, height); |
| 76 | validate(); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Shows the frame on the screen if the keep hidden flag is false. |
nothing calls this directly
no outgoing calls
no test coverage detected