ConfigureChoiceDialog.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/**
* Dialog to select which type of server we want: full DHCP or just a BOOTP
* relay. This is implemented as a singleton modal so the caller can't do
* anything until it returns a selection.
*/
public class ConfigureChoiceDialog extends JDialog
implements ButtonPanelListener {
private ButtonPanel buttonPanel;
private ButtonGroup buttonGroup;
/**
* Returned if user decides choice is "none of the above"
*/
public static final int CANCELLED = 0;
/**
* Return value if user wants DHCP service
*/
public static final int DHCP = 1;
/**
* Return value if user wants BOOTP relay
*/
public static final int BOOTP = 2;
// Must use the showDialog method to get one of these.
private ConfigureChoiceDialog(Frame f) {
super(f, true);
// Explanatory text at the top
// Just show the choices as a set of radio buttons
buttonGroup = new ButtonGroup();
dhcp = new JRadioButton(
bootp = new JRadioButton(
buttonPanel = new ButtonPanel(false);
buttonPanel.setOkEnabled(true);
}
public void buttonPressed(int buttonId) {
switch (buttonId) {
case OK:
if (dhcp.isSelected()) {
} else {
}
setVisible(false);
break;
case CANCEL:
setVisible(false);
break;
case HELP:
break;
}
}
public static int showDialog(Frame f) {
ConfigureChoiceDialog d = new ConfigureChoiceDialog(f);
d.pack();
d.setVisible(true);
d.dispose();
return value;
}
}