ButtonPanel.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:1k
- /* $Id: ButtonPanel.java,v 1.3 2002/09/09 05:50:39 parasuraman Exp $ */
- /*
- * @(#)ButtonPanel.java
- * Copyright (c) 1996-2003 AdventNet, Inc. All Rights Reserved.
- * Please read the associated COPYRIGHTS file for more details.
- */
- import java.awt.*;
- import java.util.*;
- public class ButtonPanel extends Panel {
- Button buttons[] = null;
- /**
- * Creates and adds buttons with the specified label to this panel
- * @param labels button labels
- */
- public ButtonPanel(String labels[]) {
- if (labels == null) return;
- buttons = new Button[labels.length];
- for (int i =0;i<labels.length;i++) buttons[i] = new Button(labels[i]);
- thisLayout();
- }
-
- /**
- * Get all buttons in this panel
- */
- public Button[] getButtons() {
- return buttons;
- }
-
- /**
- * Adds buttons to this panel
- */
- void thisLayout() {
- for (int i=0;i<buttons.length;i++) add(buttons[i]);
- }
-
- /**
- * Sets the font to the button's label string
- * @param font The Font to the button's label
- */
- public void setFont(Font font) {
- for (int i=0;i<buttons.length;i++) buttons[i].setFont(font);
- }
- }