FileDocCategorySizeDatePackage
Search.javaAPI DocExample3177Tue Dec 08 01:21:00 GMT 1998HumanInterface

Search

public class Search extends Frame
note
The Search dialog is a simple text entry dialog for the user to enter a string to be sued to search for Individual/s
version
0.4
author
Tim Shelley

Fields Summary
private GridLayout
gridLayout1
private Panel
panel1
private TextField
textField1
private Button
button1
private FamilyFrame
target
private String
searchName
Constructors Summary
public Search()


    
    try { setup(); }
    catch (Exception e) { e.printStackTrace(); }    
    Dimension frmSize = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation((frmSize.width - getSize().width)/ 2, (frmSize.height - getSize().height) / 2);    
  
Methods Summary
voidbutton1_actionPerformed(java.awt.event.ActionEvent e)

note
Method to handle the 'Search' button.

    searchName = textField1.getText();
    dispose();
    this.target.search();
  
java.lang.StringgetSearchName()

note
Return the string entered by the user.

    return searchName;
  
voidsetTarget(FamilyFrame target)

note
Set the target of any calls that this class needs to make to the calling class.

    this.target = target;
  
voidsetup()

    this.setSize(new Dimension(400, 60));
    this.setTitle("Search for Individual...");
    this.addWindowListener(new Search_this_windowAdapter(this));
    this.setBackground(Color.gray);
    textField1.setColumns(40);
    textField1.addKeyListener(new Search_textField1_keyAdapter(this));
    button1.setLabel("Search");
    button1.addActionListener(new Search_button1_actionAdapter(this));
    this.setLayout(gridLayout1);
    this.add(panel1, null);
    panel1.add(textField1, null);
    panel1.add(button1, null);
  
voidtextField1_keyPressed(java.awt.event.KeyEvent e)

note
This method allows the return key to be used like the pressing of the 'Search' button.

    if(e.getKeyCode() == KeyEvent.VK_ENTER)
    {
      searchName = textField1.getText();
      dispose();
      this.target.search();
    }
  
voidthis_windowClosing(java.awt.event.WindowEvent e)

note
This window handles the closing event by calling the dispose() method.

    dispose();