⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configdialogzaurus.java

📁 使用J2ME MIDP2.0實做AODV協定(RFC3561),測試平台為兩種PDA:PalmOS和PacketPC2003
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*QosAodv ver 0.2 - Java AODV (RFC 3561) Protocol HandlerCopyright 2003-2004 ComNets, University of BremenThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.*/package qosaodv.gui;import java.awt.*;import java.awt.event.*;import qosaodv.conf.*;/*** Class to display the configuration user interface and update* the changes to the configuration in a Zaurus environment.** @author : Asanga Udugama* @date : 16-feb-2004* @email : adu@comnets.uni-bremen.de**/public class ConfigDialogZaurus extends Dialog {        ConfigInfo cfgInfo, tempCfgInfo;        Panel pnlCfgPanel, pnlBtnPanel;        Button btnUpdate, btnCancel;	ScrollPane scrCfgScrollPane;	Label lblConfigFieldHeading[];	TextField txtConfigFieldData[];	int i;	//public static final int DIALOG_WIDTH = 500;	//public static final int DIALOG_HEIGHT = 280;	// error dialog components	Panel pnlError;	Label lblError;        /**        * Constructs a configuration information display and shows it.        * @param ConfigInfo cfg - the configuration object        * @param GUI gui - main user interface        */        public ConfigDialogZaurus(ConfigInfo cfg, Frame gui) {                super(gui, "J-Adhoc Configuration", true);                cfgInfo = cfg;                tempCfgInfo = new ConfigInfo();                tempCfgInfo.setValuesUsing(cfgInfo);		// setup fields                pnlCfgPanel = new Panel();                pnlCfgPanel.setLayout(new GridLayout(getRowCount(), 2));		lblConfigFieldHeading = new Label[getRowCount()];		txtConfigFieldData = new TextField[getRowCount()];		for(i = 0; i < getRowCount(); i++) {			lblConfigFieldHeading[i] = new Label(getConfigFieldInfo(i, 0));			txtConfigFieldData[i] = new TextField(getConfigFieldInfo(i, 1), 10);		}		for(i = 0; i < getRowCount(); i++) {			pnlCfgPanel.add(lblConfigFieldHeading[i]);			pnlCfgPanel.add(txtConfigFieldData[i]);		}		scrCfgScrollPane = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);		scrCfgScrollPane.add(pnlCfgPanel);		// setup buttons		pnlBtnPanel = new Panel();                btnUpdate = new Button("Update");                btnUpdate.addActionListener(                                new ActionListener() {                                        public void actionPerformed(ActionEvent e) {                                                updateConfigInfo();                                        }                                });                btnCancel = new Button("Cancel");                btnCancel.addActionListener(                                new ActionListener() {                                        public void actionPerformed(ActionEvent e) {                                                cancelConfigUpdate();                                        }                                });                pnlBtnPanel.add(btnUpdate);                pnlBtnPanel.add(btnCancel);                addWindowListener(                                new WindowAdapter() {                                        public void windowClosing(WindowEvent e) {                                                cancelConfigUpdate();                                        }                                });		lblError = new Label("");		pnlError = new Panel();		pnlError.add(lblError);		setLayout(new BorderLayout());		add(pnlError, BorderLayout.NORTH);		add(scrCfgScrollPane, BorderLayout.CENTER);		add(pnlBtnPanel, BorderLayout.SOUTH);		setBounds(gui.getBounds().x + 1, gui.getBounds().y + 10,				gui.getBounds().width - 2, gui.getBounds().height - 20);		show();        }	private String getConfigFieldInfo(int row, int column) {		if(row == 0 && column == 0)                	return tempCfgInfo.executionModeStr;                else if(row == 0 && column == 1)                	return tempCfgInfo.executionMode;                else if(row == 1 && column == 0)                        return tempCfgInfo.osInUseStr;                else if(row == 1 && column == 1)                        return tempCfgInfo.osInUse;                else if(row == 2 && column == 0)                        return tempCfgInfo.ipVersionStr;                else if(row == 2 && column == 1)                        return tempCfgInfo.ipVersion;                else if(row == 3 && column == 0)                        return tempCfgInfo.ipAddressStr;                else if(row == 3 && column == 1)                        return tempCfgInfo.ipAddress;                else if(row == 4 && column == 0)                        return tempCfgInfo.ifaceNameStr;                else if(row == 4 && column == 1)                        return tempCfgInfo.ifaceName;                else if(row == 5 && column == 0)                        return tempCfgInfo.ipAddressGatewayStr;                else if(row == 5 && column == 1)                        return tempCfgInfo.ipAddressGateway;                else if(row == 6 && column == 0)                        return tempCfgInfo.loIfaceNameStr;                else if(row == 6 && column == 1)                        return tempCfgInfo.loIfaceName;		else if(row == 7 && column == 0)                        return tempCfgInfo.loggingStatusStr;                else if(row == 7 && column == 1)                        return tempCfgInfo.loggingStatus;		else if(row == 8 && column == 0)                        return tempCfgInfo.loggingLevelStr;                else if(row == 8 && column == 1)                        return tempCfgInfo.loggingLevel;                else if(row == 9 && column == 0)                        return tempCfgInfo.logFileStr;                else if(row == 9 && column == 1)                        return tempCfgInfo.logFile;                else if(row == 10 && column == 0)                        return tempCfgInfo.pathToSystemCmdsStr;                else if(row == 10 && column == 1)                        return tempCfgInfo.pathToSystemCmds;		else if(row == 11 && column == 0)                        return tempCfgInfo.onlyDestinationStr;                else if(row == 11 && column == 1)                        return tempCfgInfo.onlyDestination;                else if(row == 12 && column == 0)                        return tempCfgInfo.gratuitousRREPStr;                else if(row == 12 && column == 1)                        return tempCfgInfo.gratuitousRREP;                else if(row == 13 && column == 0)                        return tempCfgInfo.RREPAckRequiredStr;                else if(row == 13 && column == 1)                        return tempCfgInfo.RREPAckRequired;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -