1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright (c) 1999 by Sun Microsystems, Inc. 23 * All rights reserved. 24 * 25 */ 26 27 // SLDPgui.java : The service location daemon GUI. 28 // Author: Erik Guttman 29 // 30 31 package com.sun.slp; 32 33 /** 34 * This GUI will allow the user of the slpd to monitor the daemon, 35 * shut it off, manually enter services and stuff like that. 36 * 37 * @author Erik Guttman 38 */ 39 40 import java.awt.*; 41 import java.util.*; 42 43 class SLPDgui extends Frame { 44 public SLPDgui(String configFile) { 45 46 super("slpd"); 47 48 Font font = new Font("SansSerif", Font.BOLD, 12); 49 50 setFont(font); 51 52 configFilename = configFile; 53 54 setLayout(new BorderLayout()); 55 56 // Set up a panel displaying config file. 57 Panel configPanel = new Panel(); 58 configPanel.setLayout(new FlowLayout()); 59 60 configPanel.add(new Label("Configuration file:", Label.CENTER)); 61 configPanel.add(new Label(configFile == null ? "":configFile)); 62 add("North", configPanel); 63 64 taLog = new TextArea(); 65 taLog.setEditable(false); 66 add("Center", taLog); 67 68 Panel pS = new Panel(); 69 pS.setLayout(new FlowLayout()); 70 pS.add(new Button("Quit")); 71 72 add("South", pS); 73 74 // Use JDK 1.1 event model in compatibility mode w. 1.0. 75 76 enableEvents(AWTEvent.WINDOW_EVENT_MASK); 77 78 setSize(WIDTH, HEIGHT); 79 } 80 81 public void processEvent(AWTEvent evt) { 82 if (evt.getID() == Event.WINDOW_DESTROY) { 83 try { 84 slpd.stop(); 85 86 } catch (ServiceLocationException ex) { 87 SLPConfig conf = SLPConfig.getSLPConfig(); 88 ResourceBundle bundle = conf.getMessageBundle(conf.getLocale()); 89 90 slpd.errorExit(bundle, ex); 91 92 } 93 } 94 95 super.processEvent(evt); 96 } 97 98 TextArea getTALog() { 99 100 return taLog; 101 102 } 103 104 // Size of main window. 105 106 static private int WIDTH = 780; 107 static private int HEIGHT = 750; 108 109 private String configFilename; 110 private TextArea taLog; 111 112 } 113