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 * 23 * ident "%Z%%M% %I% %E% SMI" 24 * 25 * Copyright (c) 1999 by Sun Microsystems, Inc. 26 * All rights reserved. 27 * 28 * pmButtonsScreen.java 29 * Common dialog superclass 30 */ 31 32 package com.sun.admin.pm.client; 33 34 import java.awt.*; 35 import java.awt.event.*; 36 import javax.swing.JPanel; 37 import javax.swing.*; 38 39 import com.sun.admin.pm.server.*; 40 41 42 /* 43 * Screen class for JPanels 44 */ 45 46 public class pmButtonScreen extends JPanel { 47 48 final static int OK = 1; 49 final static int APPLY = 2; 50 final static int RESET = 3; 51 final static int CANCEL = 4; 52 final static int HELP = 5; 53 54 pmButton okButton; 55 pmButton applyButton; 56 pmButton resetButton; 57 pmButton cancelButton; 58 pmButton helpButton; 59 60 southPanel()61 public void southPanel() { 62 63 JPanel south = new JPanel(); 64 65 south.setLayout(new GridBagLayout()); 66 GridBagConstraints c = new GridBagConstraints(); 67 68 c.gridheight = 1; 69 c.gridwidth = 1; 70 c.weightx = c.weighty = 0.0; 71 c.anchor = GridBagConstraints.CENTER; 72 c.fill = GridBagConstraints.HORIZONTAL; 73 c.gridy = 0; 74 75 okButton = new pmButton( 76 pmUtility.getResource("OK")); 77 okButton.setMnemonic( 78 pmUtility.getIntResource("OK.mnemonic")); 79 80 applyButton = new pmButton( 81 pmUtility.getResource("Apply")); 82 applyButton.setMnemonic( 83 pmUtility.getIntResource("Apply.mnemonic")); 84 85 resetButton = new pmButton( 86 pmUtility.getResource("Reset")); 87 resetButton.setMnemonic( 88 pmUtility.getIntResource("Reset.mnemonic")); 89 90 cancelButton = new pmButton( 91 pmUtility.getResource("Cancel")); 92 cancelButton.setMnemonic( 93 pmUtility.getIntResource("Cancel.mnemonic")); 94 95 helpButton = new pmButton( 96 pmUtility.getResource("Help")); 97 helpButton.setMnemonic( 98 pmUtility.getIntResource("Help.mnemonic")); 99 100 okButton.addActionListener(new ButtonListener(OK)); 101 applyButton.addActionListener(new ButtonListener(APPLY)); 102 resetButton.addActionListener(new ButtonListener(RESET)); 103 cancelButton.addActionListener(new ButtonListener(CANCEL)); 104 helpButton.addActionListener(new ButtonListener(HELP)); 105 106 c.insets = new Insets(15, 5, 10, 5); 107 c.gridx = 0; 108 south.add(okButton, c); 109 c.gridx = 1; 110 south.add(applyButton, c); 111 c.gridx = 2; 112 south.add(resetButton, c); 113 c.gridx = 3; 114 south.add(cancelButton, c); 115 c.gridx = 4; 116 south.add(helpButton, c); 117 118 add("South", south); 119 } 120 121 class ButtonListener implements ActionListener { 122 int activeButton; 123 124 // Constructor 125 ButtonListener(int aButton)126 public ButtonListener(int aButton) 127 { 128 activeButton = aButton; 129 } 130 actionPerformed(ActionEvent e)131 public void actionPerformed(ActionEvent e) 132 { 133 switch (activeButton) { 134 case OK: 135 actionokButton(); 136 break; 137 case APPLY: 138 actionapplyButton(); 139 break; 140 case RESET: 141 actionresetButton(); 142 break; 143 case CANCEL: 144 actioncancelButton(); 145 break; 146 case HELP: 147 actionhelpButton(); 148 break; 149 } 150 } 151 } 152 actionokButton()153 public void actionokButton() 154 { 155 } 156 actionapplyButton()157 public void actionapplyButton() 158 { 159 } 160 actionresetButton()161 public void actionresetButton() 162 { 163 } 164 actioncancelButton()165 public void actioncancelButton() 166 { 167 } 168 actionhelpButton()169 public void actionhelpButton() 170 { 171 } 172 173 174 175 } 176