home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-08-29 | 3.0 KB | 116 lines |
- /*
- A basic extension of the java.awt.Dialog class
- */
-
- import java.awt.*;
-
- public class AboutDialog extends Dialog {
- void AboutDialog_WindowClosing(java.awt.event.WindowEvent event) {
- dispose();
- }
-
- void okButton_Clicked(java.awt.event.ActionEvent event) {
- //{{CONNECTION
- // Clicked from okButton Hide the Dialog
- dispose();
- //}}
- }
-
- public AboutDialog(Frame parent, boolean modal) {
- super(parent, modal);
-
- // This code is automatically generated by Visual Cafe when you add
- // components to the visual environment. It instantiates and initializes
- // the components. To modify the code, only use code syntax that matches
- // what Visual Cafe can generate, or Visual Cafe may be unable to back
- // parse your Java file into its visual environment.
-
- //{{INIT_CONTROLS
- setLayout(null);
- setVisible(false);
- setSize(insets().left + insets().right + 333,insets().top + insets().bottom + 127);
- setFont(new Font("Dialog", Font.PLAIN, 12));
- setForeground(new Color(0));
- setBackground(new Color(16777215));
- label1 = new java.awt.Label("Amazing Adventures Travel - Custom Itinerary Application");
- label1.setBounds(insets().left + 8,insets().top + 37,311,21);
- add(label1);
- okButton = new java.awt.Button();
- okButton.setLabel("OK");
- okButton.setBounds(insets().left + 128,insets().top + 72,66,27);
- add(okButton);
- setTitle("About");
- //}}
-
- //{{REGISTER_LISTENERS
- Window lWindow = new Window();
- addWindowListener(lWindow);
- Action lAction = new Action();
- okButton.addActionListener(lAction);
- //}}
-
- }
-
- public AboutDialog(Frame parent, String title, boolean modal) {
- this(parent, modal);
- setTitle(title);
- }
-
- public void addNotify()
- {
- super.addNotify();
-
- if (fComponentsAdjusted)
- return;
-
- // Adjust components according to the insets
- setSize(insets().left + insets().right + getSize().width, insets().top + insets().bottom + getSize().height);
- Component components[] = getComponents();
- for (int i = 0; i < components.length; i++)
- {
- Point p = components[i].getLocation();
- p.translate(insets().left, insets().top);
- components[i].setLocation(p);
- }
- fComponentsAdjusted = true;
- }
-
- boolean fComponentsAdjusted = false;
-
- public synchronized void show()
- {
- Rectangle bounds = getParent().bounds();
- Rectangle abounds = bounds();
-
- move(bounds.x + (bounds.width - abounds.width)/ 2,
- bounds.y + (bounds.height - abounds.height)/2);
-
- super.show();
- }
-
- //{{DECLARE_CONTROLS
- java.awt.Label label1;
- java.awt.Button okButton;
- //}}
-
- class Window extends java.awt.event.WindowAdapter
- {
- public void windowClosing(java.awt.event.WindowEvent event)
- {
- Object object = event.getSource();
- if (object == AboutDialog.this)
- AboutDialog_WindowClosing(event);
- }
- }
-
- class Action implements java.awt.event.ActionListener
- {
- public void actionPerformed(java.awt.event.ActionEvent event)
- {
- Object object = event.getSource();
- if (object == okButton)
- okButton_Clicked(event);
- }
- }
- }
-