home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 5.4 KB | 197 lines |
- /*
- A basic extension of the java.awt.Frame class
- */
- package symantec.itools.db.beans.binding;
-
- import java.awt.*;
-
- import symantec.itools.awt.shape.Rect;
- import symantec.itools.awt.WrappingLabel;
- public class SaveChangesWindow extends symantec.itools.awt.util.dialog.ModalDialog implements SaveChangesDialog
- {
- public SaveChangesWindow()
- {
-
- this(true);
-
-
- //{{REGISTER_LISTENERS
- SymAction lSymAction = new SymAction();
- button2.addActionListener(lSymAction);
- //}}
- }
- public SaveChangesWindow(boolean cancel)
- {
- // 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
-
- super(new Frame(), "");
- setLayout(null);
- setVisible(false);
- setSize(insets().left + insets().right + 320,insets().top + insets().bottom + 160);
- super.getParent().setBounds(20,20,insets().left + insets().right + 320,insets().top + insets().bottom + 160);
- setBackground(new Color(12632256));
- panel1 = new java.awt.Panel();
- panel1.setLayout(null);
- panel1.setBounds(0,0,320,110);
- panel1.setBackground(new Color(12632256));
- add(panel1);
- rect1 = new symantec.itools.awt.shape.Rect();
- try {
- rect1.setBevelStyle(symantec.itools.awt.shape.Rect.BEVEL_LOWERED);
- }
- catch(java.beans.PropertyVetoException e) { }
- rect1.setBounds(5,12,310,90);
- panel1.add(rect1);
- label1 = new java.awt.Label("Warning",Label.CENTER);
- label1.setBounds(14,4,54,18);
- label1.setFont(new Font("Dialog", Font.BOLD, 12));
- panel1.add(label1);
- label2 = new java.awt.Label("You have made some changes in your details.",Label.CENTER);
- label2.setBounds(17,30,285,23);
- panel1.add(label2);
- label3 = new java.awt.Label("Do you wish to save them before proceeding ?",Label.CENTER);
- label3.setBounds(17,58,285,23);
- panel1.add(label3);
- panel2 = new java.awt.Panel();
- if(cancel)panel2.setLayout(new GridLayout(1,3,20,0));
- else panel2.setLayout(new GridLayout(1,2,40,0));
- panel2.setBounds(10,110,300,40);
- panel2.setBackground(new Color(12632256));
- add(panel2);
- button1 = new java.awt.Button();
- button1.setLabel("Save");
- button1.setBounds(0,0,300,40);
- button1.setFont(new Font("Dialog", Font.BOLD, 12));
- button1.setBackground(new Color(12632256));
- panel2.add(button1);
- button2 = new java.awt.Button();
- button2.setLabel("Discard");
- button2.setBounds(106,0,140,40);
- button2.setFont(new Font("Dialog", Font.BOLD, 12));
- button2.setBackground(new Color(12632256));
- panel2.add(button2);
- button3 = new java.awt.Button();
- button3.setLabel("Cancel");
- button3.setBounds(212,0,86,40);
- button3.setFont(new Font("Dialog", Font.BOLD, 12));
- button3.setBackground(new Color(12632256));
- if(cancel)panel2.add(button3);
- setTitle("Untitled");
- //}}
-
- //{{INIT_MENUS
- //}}
-
- //{{REGISTER_LISTENERS
- SymAction lSymAction = new SymAction();
- button1.addActionListener(lSymAction);
- button2.addActionListener(lSymAction);
- button3.addActionListener(lSymAction);
- //}}
- }
-
- public SaveChangesWindow(String title)
- {
- this();
- setTitle(title);
- }
-
- /**
- * Shows or hides the component depending on the boolean flag b.
- * @param b if true, show the component; otherwise, hide the component.
- * @see java.awt.Component#isVisible
- */
- public void setVisible(boolean b)
- {
- if(b)
- {
- setLocation(50, 50);
- }
- super.setVisible(b);
- }
-
- public void addNotify()
- {
- // Record the size of the window prior to calling parents addNotify.
- Dimension d = getSize();
-
- super.addNotify();
-
- if (fComponentsAdjusted)
- return;
-
- // Adjust components according to the insets
- setSize(insets().left + insets().right + d.width, insets().top + insets().bottom + d.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;
- }
-
- // Used for addNotify check.
- boolean fComponentsAdjusted = false;
-
- //{{DECLARE_CONTROLS
- java.awt.Panel panel1;
- symantec.itools.awt.shape.Rect rect1;
- java.awt.Label label1;
- java.awt.Label label2;
- java.awt.Label label3;
- java.awt.Panel panel2;
- java.awt.Button button1;
- java.awt.Button button2;
- java.awt.Button button3;
- //}}
-
- //{{DECLARE_MENUS
- //}}
- int returnval=0;
- public int run(){
- super.show();
- return returnval;
- }
-
-
- class SymAction implements java.awt.event.ActionListener
- {
- public void actionPerformed(java.awt.event.ActionEvent event)
- {
- Object object = event.getSource();
- if (object == button1)
- button1_ActionPerformed(event);
- else if (object == button3)
- button3_ActionPerformed(event);
- else if (object == button2)
- button2_ActionPerformed(event);
- }
- }
-
- void button1_ActionPerformed(java.awt.event.ActionEvent event)
- {
- returnval=YES;
- closeDialog();
- }
- void button2_ActionPerformed(java.awt.event.ActionEvent event)
- {
- returnval=NO;
- closeDialog();
- //}}
- }
- void button3_ActionPerformed(java.awt.event.ActionEvent event)
- {
- returnval=CANCEL;
- closeDialog();
- }
-
-
- }
-