?? infopanel.java
字號:
package ipconfig;import java.awt.*;import javax.swing.*;import java.io.*;import java.net.*;import java.awt. event.*;import javax.swing.border.*;/** * Title: 獲取網站信息 * Description: 該實例從Internet網絡中獲取一個服務器的IP地址、機器名稱、子網掩碼、DNS配置等信息。 * Copyright: Copyright (c) 2002 * Company: 北京師范大學計算機系 * @author 梁志偉 * @version 1.0 */public class InfoPanel extends JPanel { GridLayout gridLayout1 = new GridLayout(5,2,1,1); JLabel displayLabel = new JLabel(); JLabel namelabel = new JLabel(); JLabel name = new JLabel(); JLabel ipLabel = new JLabel(); JLabel ip = new JLabel(); JLabel display = new JLabel(); JLabel host = new JLabel(); JLabel hostLabel = new JLabel(); JLabel full = new JLabel(); JLabel fullLabel = new JLabel(); Info cfg; public InfoPanel(Info cfg) { this.cfg =cfg; try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { Border border=new BevelBorder(BevelBorder.RAISED); String names=cfg.getName() ; border=new TitledBorder(border,names); setBorder(border); displayLabel.setText("DisplayName:"); this.setLayout(gridLayout1); namelabel.setText("Name:"); name.setForeground(Color.red); name.setText(cfg.getName() ); ipLabel.setText("Address:"); ip.setForeground(Color.red); ip.setText(cfg.getAddress() ); display.setForeground(Color.red); display.setText(cfg.getDisplayName()); host.setForeground(Color.red); host.setText(cfg.getHostName()); hostLabel.setText("HosName:"); full.setForeground(Color.red); full.setText(cfg.getFullName() ); fullLabel.setText("FullName:"); this.add(displayLabel, null); this.add(display, null); this.add(namelabel, null); this.add(name, null); this.add(ipLabel, null); this.add(ip, null); this.add(hostLabel, null); this.add(host, null); this.add(fullLabel, null); this.add(full, null);}}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -