📄 connectivityframe.java
字号:
/*
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.util.StringTokenizer;import java.awt.Toolkit;import javax.swing.JFrame;import com.intel.mobile.base.EventProperty;import com.intel.mobile.base.IntelMobileException;import com.intel.mobile.context.ConnectivityInstance;import com.intel.mobile.context.ContextClass;/** * <class or interface desc> */public class ConnectivityFrame extends JFrame{ private static ContextClass tempContextClass = null; private javax.swing.JPanel jContentPane = null; private javax.swing.JTabbedPane jTabbedPane = null; private javax.swing.JPanel jPanelGeneral = null; private javax.swing.JLabel jLabel1 = null; private javax.swing.JLabel jLabel2 = null; private javax.swing.JLabel jLabel3 = null; private javax.swing.JLabel jLabel4 = null; private javax.swing.JLabel jLabel5 = null; private javax.swing.JLabel jLabel6 = null; private javax.swing.JLabel jLabel7 = null; private javax.swing.JTextField jTextFieldProx = null; private javax.swing.JTextField jTextFieldUser = null; private javax.swing.JTextField jTextFieldPass = null; private javax.swing.JTextField jTextFieldTime = null; private javax.swing.JTextField jTextFieldRetry = null; private javax.swing.JButton jButton1 = null; private javax.swing.JTextField jTextFieldUri = null; private javax.swing.JLabel jLabelConnected = null; private javax.swing.JButton jButton = null; private javax.swing.JScrollPane jScrollPaneText = null; private javax.swing.JTextArea jTextArea = null; private FunctionEventPanel jFunctionPanelEvent=null; ConnectivityInstance myInstance = null; static { try { tempContextClass = new ContextClass(); } catch (IntelMobileException ex) { ex.printStackTrace(); } } /** * This is the default constructor */ public ConnectivityFrame(ConnectivityInstance myInstance) throws IntelMobileException { super(); this.myInstance = myInstance; initialize(); } public ConnectivityFrame(String myInstanceKey) throws IntelMobileException { super(); this.myInstance = (ConnectivityInstance)tempContextClass.GetInstance(myInstanceKey); initialize(); this.addWindowListener(new java.awt.event.WindowListener(){ public void windowActivated(java.awt.event.WindowEvent e) { RefreshProperties(); } public void windowOpened(java.awt.event.WindowEvent e) { } public void windowClosing(java.awt.event.WindowEvent e) { } public void windowClosed(java.awt.event.WindowEvent e) { } public void windowIconified(java.awt.event.WindowEvent e) { } public void windowDeiconified(java.awt.event.WindowEvent e) { } public void windowDeactivated(java.awt.event.WindowEvent e) { } }); } /** * 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.setTitle("Connectivity Information"); this.setResizable(false); } private void RefreshProperties() { try { this.jLabelConnected.setText(String.valueOf(myInstance.IsConnected.GetValue())); } catch(Exception e) { } } /** * 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 javax.swing.JTabbedPane getJTabbedPane() throws IntelMobileException { if (jTabbedPane == null) { jTabbedPane = new javax.swing.JTabbedPane(); jTabbedPane.addTab("General", null, getJPanelGeneral(), null); jTabbedPane.addTab("Function Event", null, getJPanelFunctionEvent(), null); initialFunctionEvent(); } return jTabbedPane; } private void initialFunctionEvent() { AddFunctionEvent(this.myInstance.StatusChanged,"StatusChanged"); AddFunctionEvent(this.myInstance.Connected,"Connected"); AddFunctionEvent(this.myInstance.Disconnected,"Disconnected"); AddFunctionEvent(this.myInstance.IpAddressChanged,"IpAddressChanged"); AddFunctionEvent(this.myInstance.RouteTableChanged,"RouteTableChanged"); } private void AddFunctionEvent(EventProperty event, String eventName) { getJPanelFunctionEvent().PropertyEventPanel.dataModel.addEventItem(event,eventName,"",this.myInstance); } private FunctionEventPanel getJPanelFunctionEvent() { if (jFunctionPanelEvent == null) { jFunctionPanelEvent = new FunctionEventPanel(); } return jFunctionPanelEvent; } /** * This method initializes jPanelGeneral * * @return javax.swing.JPanel */ private javax.swing.JPanel getJPanelGeneral() throws IntelMobileException { if (jPanelGeneral == null) { jPanelGeneral = new javax.swing.JPanel(); jPanelGeneral.setLayout(null); jPanelGeneral.add(getJLabel1(), null); jPanelGeneral.add(getJLabel2(), null); jPanelGeneral.add(getJLabel3(), null); jPanelGeneral.add(getJLabel4(), null); jPanelGeneral.add(getJLabel5(), null); jPanelGeneral.add(getJLabel6(), null); jPanelGeneral.add(getJLabel7(), null); jPanelGeneral.add(getJTextFieldUri(), null); jPanelGeneral.add(getJTextFieldProx(), null); jPanelGeneral.add(getJTextFieldUser(), null); jPanelGeneral.add(getJTextFieldPass(), null); jPanelGeneral.add(getJTextFieldTime(), null); jPanelGeneral.add(getJTextFieldRetry(), null); jPanelGeneral.add(getJLabelConnected(), null); jPanelGeneral.add(getJButton(), null); jPanelGeneral.add(getJButton1(), null); jPanelGeneral.add(getJScrollPaneText(), null); } return jPanelGeneral; } /** * This method initializes jLabel1 * * @return javax.swing.JLabel */ private javax.swing.JLabel getJLabel1() { if (jLabel1 == null) { jLabel1 = new javax.swing.JLabel(); jLabel1.setBounds(25, 10, 100, 25); jLabel1.setText("Destination URI:"); jLabel1.setToolTipText(""); } return jLabel1; } private javax.swing.JLabel getJLabel3() { if (jLabel3 == null) { jLabel3 = new javax.swing.JLabel(); jLabel3.setBounds(25, 40, 100, 25); jLabel3.setText("Proxy URI:"); jLabel3.setToolTipText(""); } return jLabel3; } private javax.swing.JLabel getJLabel4() { if (jLabel4 == null) { jLabel4 = new javax.swing.JLabel(); jLabel4.setBounds(25, 70, 100, 25); jLabel4.setText("UserName:"); jLabel4.setToolTipText(""); } return jLabel4; } private javax.swing.JLabel getJLabel5() { if (jLabel5 == null) { jLabel5 = new javax.swing.JLabel(); jLabel5.setBounds(250, 70, 100, 25); jLabel5.setText("Password:"); jLabel5.setToolTipText(""); } return jLabel5; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -