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, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * 24 * ident "%Z%%M% %I% %E% SMI" 25 * 26 * Copyright (c) 1999-2001 by Sun Microsystems, Inc. 27 * All rights reserved. 28 * 29 * pmAboutBox.java 30 * 31 */ 32 33 package com.sun.admin.pm.client; 34 35 import java.awt.*; 36 import java.awt.event.*; 37 import javax.swing.*; 38 import javax.swing.border.*; 39 40 import com.sun.admin.pm.server.*; 41 42 43 public class pmAboutBox extends pmFrame { 44 public pmButton cancel = null; 45 String title = pmUtility.getResource("About.Solaris.Print.Manager"); 46 String copyright = new String(pmUtility.getResource("info_copyright1") 47 + pmUtility.getCopyrightResource("copyright_year") 48 + pmUtility.getResource("info_copyright2")); 49 String version = pmUtility.getResource("info_version"); 50 String appname = pmUtility.getResource("info_name"); 51 String contents = new String(appname + "\n" + 52 version + "\n\n" + 53 copyright + "\n"); 54 pmAboutBox()55 public pmAboutBox() { 56 57 super(pmUtility.getResource("About.Solaris.Print.Manager")); 58 59 cancel = new pmButton(pmUtility.getResource("Cancel")); 60 cancel.setMnemonic(pmUtility.getIntResource("Cancel.mnemonic")); 61 cancel.addActionListener(new ActionListener() { 62 public void actionPerformed(ActionEvent e) { 63 hideAboutBox(); 64 } 65 }); 66 67 // Create a regular text field. 68 JTextArea textArea = new JTextArea(contents); 69 Font f = new pmJTextField().getFont(); 70 Font fb = new Font(f.getName(), f.PLAIN, f.getSize()); 71 textArea.setOpaque(false); 72 textArea.setFont(fb); 73 textArea.setLineWrap(true); 74 textArea.setWrapStyleWord(true); 75 textArea.setEditable(false); 76 textArea.setDisabledTextColor(Color.blue); 77 78 JPanel j1 = new JPanel(); 79 j1.setBorder(new EmptyBorder(10, 10, 10, 10)); 80 j1.setLayout(new BorderLayout()); 81 JScrollPane areaScrollPane = new JScrollPane(textArea); 82 areaScrollPane.setPreferredSize(new Dimension(270, 175)); 83 j1.add(areaScrollPane, BorderLayout.CENTER); 84 85 JPanel buttonPanel = new JPanel(); 86 buttonPanel.setBorder(new EmptyBorder(0, 0, 10, 10)); 87 buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); 88 buttonPanel.add(cancel); 89 90 JPanel bottomPanel = new JPanel(new BorderLayout()); 91 bottomPanel.add(buttonPanel, BorderLayout.SOUTH); 92 93 Container contentPane = getContentPane(); 94 contentPane.add(j1, BorderLayout.CENTER); 95 contentPane.add(bottomPanel, BorderLayout.SOUTH); 96 97 // default button is cancel 98 cancel.setAsDefaultButton(); 99 100 // handle Esc as cancel 101 getRootPane().registerKeyboardAction(new ActionListener() { 102 public void actionPerformed(ActionEvent e) { 103 Debug.message("HELP: cancel action"); 104 hideAboutBox(); 105 }}, 106 KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false), 107 JComponent.WHEN_IN_FOCUSED_WINDOW); 108 109 pack(); 110 repaint(); 111 112 } 113 hideAboutBox()114 public void hideAboutBox() { 115 this.setVisible(false); 116 } 117 } 118