netadapterframe.java

来自「270的linux说明」· Java 代码 · 共 649 行 · 第 1/2 页

JAVA
649
字号
/*

Copyright (c) 2008, Intel Corporation. 

All rights reserved.

 

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met:


    * Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer.

    * Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation and/or 
other materials provided with the distribution.

    * Neither the name of Intel Corporation nor the names of its contributors 
may be used to endorse or promote products derived from this software without 
specific prior written permission.

 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.

*/import java.awt.BorderLayout;import java.awt.GraphicsConfiguration;import java.awt.HeadlessException;import java.awt.Toolkit;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTabbedPane;import javax.swing.JTable;import javax.swing.table.TableModel;import com.intel.mobile.base.EventProperty;import com.intel.mobile.base.IntelMobileException;import com.intel.mobile.base.Property;import com.intel.mobile.network.WiredAdapterClass;import com.intel.mobile.network.WiredAdapterInstance;import com.intel.mobile.network.*;/* * Created on 2004-6-16 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments *//** * @ * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */public class NetAdapterFrame extends JFrame {	private javax.swing.JPanel jContentPane = null;	private WiredAdapterInstance wiredadapterInstance = null;	private static WiredAdapterClass tempWiredAdapterClass = null;	private PropertyEventPanel jPropertyPanelEvent = null;	private FunctionEventPanel jFunctionPanelEvent=null;	private ThresholdsPanel jThresholdPanel=null;		private JTabbedPane jTabbedPane = null;	private JPanel jPanelGeneral = null;	private JPanel jPanelAdvanced = null;	private JPanel jPanelEvent = null;	private JScrollPane jScrollPane = null;	private JTable jTable = null;	private TableModel dataModel = null;	private javax.swing.JLabel jLabel = null;	private javax.swing.JLabel jLabel2 = null;	private javax.swing.JLabel jLabel3 = null;	private javax.swing.JPanel jPanel = null;	private javax.swing.JLabel jLabel1 = null;	private javax.swing.JLabel jLabel4 = null;	private javax.swing.JPanel jPanel1 = null;	private javax.swing.JLabel jLabel5 = null;	private javax.swing.JLabel jLabel6 = null;	private javax.swing.JLabel jLabel7 = null;	private javax.swing.JLabel jLabel8 = null;	private javax.swing.JLabel jLabel9 = null;	private javax.swing.JLabel jLabel10 = null;	private javax.swing.JLabel jLabel11 = null;	private javax.swing.JLabel jLabel12 = null;	private javax.swing.JLabel jLabel13 = null;	private javax.swing.JLabel jLabel14 = null;        static    {        try        {            tempWiredAdapterClass = new WiredAdapterClass();        }        catch (IntelMobileException ex)        {            ex.printStackTrace();        }    }    	/**	 * This is the default constructor	 */	public NetAdapterFrame(WiredAdapterInstance myInstance) throws HeadlessException, IntelMobileException {		super();		wiredadapterInstance  = myInstance;		dataModel = new WiredAdapterTableModel(myInstance);		initialize();	}		/**	 * @param arg0	 */	public NetAdapterFrame(GraphicsConfiguration arg0) throws IntelMobileException {		super(arg0);		initialize();	}	/**	 * @param arg0	 * @throws java.awt.HeadlessException	 */	public NetAdapterFrame(String arg0) throws HeadlessException, IntelMobileException {		super();		wiredadapterInstance  = (WiredAdapterInstance)tempWiredAdapterClass.GetInstance(arg0);		dataModel = new WiredAdapterTableModel(wiredadapterInstance);		initialize();	}	/**	 * @param arg0	 * @param arg1	 */	public NetAdapterFrame(String arg0, GraphicsConfiguration arg1) throws IntelMobileException {		super(arg0, arg1);		initialize();	}		/**	 * This method initializes this	 * 	 * @return void	 */	private void initialize() throws IntelMobileException {		this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/Resx/Java-app_ico16.gif")));		this.setSize(620, 400);		this.setContentPane(getJContentPane());		this.setResizable(false);		this.setTitle("Wired Network Adapter Information");	}	/**	 * This method initializes jContentPane	 * 	 * @return javax.swing.JPanel	 */	private javax.swing.JPanel getJContentPane() throws IntelMobileException {		if (jContentPane == null) {			jContentPane = new javax.swing.JPanel();			jContentPane.setLayout(new java.awt.BorderLayout());			jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);		}		return jContentPane;	}    	/**	 * This method initializes jTabbedPane	 * 	 * @return javax.swing.JTabbedPane	 */	private JTabbedPane getJTabbedPane() throws IntelMobileException	{		if (jTabbedPane == null)		{			jTabbedPane = new JTabbedPane();			jTabbedPane.addTab("General", null, getJPanelGeneral(), null);			jTabbedPane.addTab("Advanced", null, getJPanelAdvanced(), null);			jTabbedPane.addTab("Property Change Event", null, getJPanelPropertyEvent(), null);			jTabbedPane.addTab("Function Event", null, getJPanelFunctionEvent(), null);			jTabbedPane.addTab("Threshold", null, getJPanelThreshold(), null);						initialFunctionEvent();			initialPropertyEvent();		}		return jTabbedPane;	}		private void initialFunctionEvent()	{		AddFunctionEvent(this.wiredadapterInstance.StatusChanged,"StatusChanged");	}		private void AddFunctionEvent(EventProperty event, String eventName)	{					getJPanelFunctionEvent().PropertyEventPanel.dataModel.addEventItem(event,eventName,"",this.wiredadapterInstance);				}		private void initialPropertyEvent()	{					AddProperty(this.wiredadapterInstance.Index);			AddProperty(this.wiredadapterInstance.AutoSense);			AddProperty(this.wiredadapterInstance.Manufacturer);			AddProperty(this.wiredadapterInstance.Name);			AddProperty(this.wiredadapterInstance.Description);			AddProperty(this.wiredadapterInstance.DeviceId);			AddProperty(this.wiredadapterInstance.ConnectionId);			AddProperty(this.wiredadapterInstance.PnpDeviceId);			AddProperty(this.wiredadapterInstance.Enabled);						AddProperty(this.wiredadapterInstance.NdiUpper);			AddProperty(this.wiredadapterInstance.NdiLower);			AddProperty(this.wiredadapterInstance.Protocols);			AddProperty(this.wiredadapterInstance.ConnectionState);			AddProperty(this.wiredadapterInstance.AdapterLink);					}		private void AddProperty(Property property)	{		try		{			if(!property.IsStatic())			{				getJPanelPropertyEvent().PropertyEventPanel.dataModel.addEventItem(property,property.GetName(),"",this.wiredadapterInstance);				getJPanelThreshold().addPropertyItem(property);			}		}catch(IntelMobileException e)		{		}	}    	/**	 * This method initializes jPanelGeneral	 * 	 * @return javax.swing.JPanel	 */	private JPanel getJPanelGeneral() throws IntelMobileException	{		if (jPanelGeneral == null)		{			jPanelGeneral = new JPanel();			jPanelGeneral.setLayout(null);			jPanelGeneral.add(getJLabel(), null);			jPanelGeneral.add(getJPanel(), null);			jPanelGeneral.add(getJPanel1(), null);		}		return jPanelGeneral;	}    	/**	 * This method initializes jPanelAdvanced	 * 	 * @return javax.swing.JPanel	 */	private JPanel getJPanelAdvanced() {		if(jPanelAdvanced == null) {			jPanelAdvanced = new JPanel();			jPanelAdvanced.setLayout(new BorderLayout());			jPanelAdvanced.add(getJScrollPane(), BorderLayout.CENTER);		}		return jPanelAdvanced;	}    	private PropertyEventPanel getJPanelPropertyEvent()    {		if (jPropertyPanelEvent == null)        {			jPropertyPanelEvent = new PropertyEventPanel();		}		return jPropertyPanelEvent;	}			private FunctionEventPanel getJPanelFunctionEvent()    {		if (jFunctionPanelEvent == null)        {			jFunctionPanelEvent = new FunctionEventPanel();		}		return jFunctionPanelEvent;	}    	private ThresholdsPanel getJPanelThreshold()    {		if (jThresholdPanel == null)        {			jThresholdPanel = new ThresholdsPanel();		}		return jThresholdPanel;	}		/**	 * This method initializes jScrollPane	 * 	 * @return javax.swing.JScrollPane	 */	private JScrollPane getJScrollPane()	{		if (jScrollPane == null)		{			jScrollPane = new JScrollPane();			jScrollPane.setViewportView(getJTable());		}		return jScrollPane;	}    	/**

⌨️ 快捷键说明

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