Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/print/applet/YesNo.java
38838 views
/*1* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import java.awt.*;24import java.awt.event.*;2526public class YesNo extends Panel implements ActionListener {2728static String nl = System.getProperty("line.Separator", "\n");29static String instructions =30"Wait until 5 applets have initialised and started and display string"31+nl+32"messages. Applet 0 and Applet 2 should find one less print service"33+nl+34"than the rest."35+nl+36"Specifically all except Applets 0 and 2 should find a service called"37+nl+38"Applet N printer where N is the number of the applet."39+nl+40"They should *NOT* find Applet M printer (where M != N)."41+nl+42"After deciding if the test passes, Quit appletviewer, and next"43+nl+44"Select either the Pass or Fail button below";454647public static void main(String args[]) {48Frame f = new Frame("Test Execution Instructions");49f.setLayout(new BorderLayout());50TextArea ta = new TextArea(instructions, 12,80);51ta.setEditable(false);52f.add(BorderLayout.CENTER, ta);53f.add(BorderLayout.SOUTH, new YesNo());54f.pack();55f.setVisible(true);56}5758public YesNo() {59Button pass = new Button("Pass");60Button fail = new Button("Fail");61pass.addActionListener(this);62fail.addActionListener(this);63add(pass);64add(fail);65}6667public void actionPerformed(ActionEvent e) {68if (e.getActionCommand().equals("Pass")) {69System.exit(0);70} else {71System.exit(-1);72}73}7475}767778