home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-12-08 | 2.8 KB | 90 lines |
- /*
- A basic extension of the java.awt.Dialog class
- */
-
- import java.awt.*;
-
- public class ReplaceDialog extends Dialog {
-
- public ReplaceDialog(Frame parent, boolean modal) {
-
- super(parent, modal);
-
- //{{INIT_CONTROLS
- setLayout(null);
- addNotify();
- resize(insets().left + insets().right + 393,insets().top + insets().bottom + 144);
- setBackground(new Color(12632256));
- findText = new java.awt.TextField();
- findText.reshape(insets().left + 100,insets().top + 10,190,20);
- findText.setBackground(new Color(12632256));
- add(findText);
- findButton = new java.awt.Button("Find");
- findButton.reshape(insets().left + 300,insets().top + 10,80,20);
- add(findButton);
- cancelButton = new java.awt.Button("Cancel");
- cancelButton.reshape(insets().left + 300,insets().top + 100,80,20);
- cancelButton.setFont(new Font("Dialog", Font.BOLD, 10));
- add(cancelButton);
- label1 = new java.awt.Label("Find What");
- label1.reshape(insets().left + 0,insets().top + 10,80,16);
- add(label1);
- m_MatchCase = new java.awt.Checkbox("Match case");
- m_MatchCase.reshape(insets().left + 10,insets().top + 80,100,20);
- m_MatchCase.setBackground(new Color(12632256));
- add(m_MatchCase);
- replaceButton = new java.awt.Button("Replace");
- replaceButton.reshape(insets().left + 300,insets().top + 40,80,20);
- replaceButton.setFont(new Font("Dialog", Font.BOLD, 10));
- add(replaceButton);
- replaceAllButton = new java.awt.Button("Replace All");
- replaceAllButton.reshape(insets().left + 300,insets().top + 70,80,20);
- replaceAllButton.setFont(new Font("Dialog", Font.BOLD, 10));
- add(replaceAllButton);
- replaceText = new java.awt.TextField();
- replaceText.reshape(insets().left + 100,insets().top + 40,190,20);
- replaceText.setBackground(new Color(12632256));
- add(replaceText);
- label2 = new java.awt.Label("Replace With");
- label2.reshape(insets().left + 0,insets().top + 40,90,16);
- add(label2);
- setTitle("");
- //}}
- }
-
- public ReplaceDialog(Frame parent, String title, boolean modal) {
- this(parent, modal);
- setTitle(title);
- }
-
- 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();
- }
-
- public boolean handleEvent(Event event) {
- if(event.id == Event.WINDOW_DESTROY) {
- hide();
- return true;
- }
- return super.handleEvent(event);
- }
-
- //{{DECLARE_CONTROLS
- java.awt.TextField findText;
- java.awt.Button findButton;
- java.awt.Button cancelButton;
- java.awt.Label label1;
- java.awt.Checkbox m_MatchCase;
- java.awt.Button replaceButton;
- java.awt.Button replaceAllButton;
- java.awt.TextField replaceText;
- java.awt.Label label2;
- //}}
- }
-