home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / SAMPLES.BIN / ReplaceDialog.java < prev    next >
Encoding:
Java Source  |  1996-12-08  |  2.8 KB  |  90 lines

  1. /*
  2.     A basic extension of the java.awt.Dialog class
  3.  */
  4.  
  5. import java.awt.*;
  6.  
  7. public class ReplaceDialog extends Dialog {
  8.  
  9.     public ReplaceDialog(Frame parent, boolean modal) {
  10.  
  11.         super(parent, modal);
  12.  
  13.         //{{INIT_CONTROLS
  14.         setLayout(null);
  15.         addNotify();
  16.         resize(insets().left + insets().right + 393,insets().top + insets().bottom + 144);
  17.         setBackground(new Color(12632256));
  18.         findText = new java.awt.TextField();
  19.         findText.reshape(insets().left + 100,insets().top + 10,190,20);
  20.         findText.setBackground(new Color(12632256));
  21.         add(findText);
  22.         findButton = new java.awt.Button("Find");
  23.         findButton.reshape(insets().left + 300,insets().top + 10,80,20);
  24.         add(findButton);
  25.         cancelButton = new java.awt.Button("Cancel");
  26.         cancelButton.reshape(insets().left + 300,insets().top + 100,80,20);
  27.         cancelButton.setFont(new Font("Dialog", Font.BOLD, 10));
  28.         add(cancelButton);
  29.         label1 = new java.awt.Label("Find What");
  30.         label1.reshape(insets().left + 0,insets().top + 10,80,16);
  31.         add(label1);
  32.         m_MatchCase = new java.awt.Checkbox("Match case");
  33.         m_MatchCase.reshape(insets().left + 10,insets().top + 80,100,20);
  34.         m_MatchCase.setBackground(new Color(12632256));
  35.         add(m_MatchCase);
  36.         replaceButton = new java.awt.Button("Replace");
  37.         replaceButton.reshape(insets().left + 300,insets().top + 40,80,20);
  38.         replaceButton.setFont(new Font("Dialog", Font.BOLD, 10));
  39.         add(replaceButton);
  40.         replaceAllButton = new java.awt.Button("Replace All");
  41.         replaceAllButton.reshape(insets().left + 300,insets().top + 70,80,20);
  42.         replaceAllButton.setFont(new Font("Dialog", Font.BOLD, 10));
  43.         add(replaceAllButton);
  44.         replaceText = new java.awt.TextField();
  45.         replaceText.reshape(insets().left + 100,insets().top + 40,190,20);
  46.         replaceText.setBackground(new Color(12632256));
  47.         add(replaceText);
  48.         label2 = new java.awt.Label("Replace With");
  49.         label2.reshape(insets().left + 0,insets().top + 40,90,16);
  50.         add(label2);
  51.         setTitle("");
  52.         //}}
  53.     }
  54.  
  55.     public ReplaceDialog(Frame parent, String title, boolean modal) {
  56.         this(parent, modal);
  57.         setTitle(title);
  58.     }
  59.  
  60.     public synchronized void show() {
  61.         Rectangle bounds = getParent().bounds();
  62.         Rectangle abounds = bounds();
  63.  
  64.         move(bounds.x + (bounds.width - abounds.width)/ 2,
  65.              bounds.y + (bounds.height - abounds.height)/2);
  66.  
  67.         super.show();
  68.     }
  69.  
  70.     public boolean handleEvent(Event event) {
  71.         if(event.id == Event.WINDOW_DESTROY) {
  72.             hide();
  73.             return true;
  74.         }
  75.         return super.handleEvent(event);
  76.     }
  77.  
  78.     //{{DECLARE_CONTROLS
  79.     java.awt.TextField findText;
  80.     java.awt.Button findButton;
  81.     java.awt.Button cancelButton;
  82.     java.awt.Label label1;
  83.     java.awt.Checkbox m_MatchCase;
  84.     java.awt.Button replaceButton;
  85.     java.awt.Button replaceAllButton;
  86.     java.awt.TextField replaceText;
  87.     java.awt.Label label2;
  88.     //}}
  89. }
  90.