/***************************************************************************** * $Id: NameSearch.java,v 1.1.1.1 2000/03/29 22:58:15 kkeys Exp $ * * File: NameSearch.java Class: NameSearch * Goal: To provide a methoid for searching for machine that * contain a given string. * * Written: Bradley Huffaker (01/08/97) * * For: Cooperative Assoctiation for Internet Data Analysis ****************************************************************************** ****************************************************************************** $Id: By accessing this software, NAMESEARCH, you are duly informed of and agree to be bound by the conditions described below in this notice: This software product, NAMESEARCH, is developed by Bradley Huffaker, and Jaeyeon Jung copyrighted(C) 1998 by the University of California, San Diego (UCSD), with all rights reserved. UCSD administers the NLANR Cache grants, NCR-9796082 and NCR-9616602, under which most of this code was developed. There is no charge for NAMESEARCH software. You can redistribute it and/or modify it under the terms of the GNU General Public License, v. 2 dated June 1991 which is incorporated by reference herein. NAMESEARCH is distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE or that the use of it will not infringe on any third party's intellectual property rights. You should have received a copy of the GNU GPL along with the NAMESEARCH program. Copies can also be obtained from http://www.gnu.org/copyleft/gpl.html or by writing to University of California, San Diego SDSC/CAIDA/NLANR 9500 Gilman Dr., MS-0505 La Jolla, CA 92093 - 0505 USA Or contact INFO@NLANR.NET *****************************************************************************/ package bhuffake.plankton; import java.awt.*; public class NameSearch extends Frame { // The display that contains the nodes to highlight Display display; // The text for search on TextField text; // The controling buttons Button Search; Button Cancel; public NameSearch(Display display_input) { super("Select by Name"); display = display_input; text = new TextField(); Search = new Button("Search"); Cancel = new Button("Cancel"); Label top_label = new Label("Will match all nodes that contain"); Label middle_label = new Label("string:"); // Formating Panel middle_panel = new Panel(); middle_panel.setLayout( new BorderLayout()); middle_panel.add("West",middle_label); middle_panel.add("Center",text); Panel bottom_panel = new Panel(); //bottom_panel.setLayout(new BorderLayout()); bottom_panel.setLayout(new FlowLayout()); bottom_panel.add(Search); bottom_panel.add(Cancel); setLayout(new BorderLayout()); add("North",top_label); add("Center",middle_panel); add("South",bottom_panel); pack(); } public boolean handleEvent(Event event) { if (event.id == Event.ACTION_EVENT) { if (event.target == Cancel) this.hide(); else if (event.target == Search || event.target == text) display.selectByName(text.getText()); } return super.handleEvent(event); } }