我建了一个JAVA图形界面的空架子,写好了一个JAVA类,其运行结果为System.out.println();输出的,现在我想将其放入到图形界面的下拉选项中,该如何操作呢?求教.../*
 * 这个类负责界面
 * 1.继承JFrame
 * 2.定义所需要的组件
 * 3.在构造函数中添加组件
 * 5.对窗体设置
 */
package com.ccy.test;import javax.swing.*;import java.awt.*;
import java.awt.event.*;public class ArpGui extends JFrame implements ActionListener { JLabel label1;// 选择网卡标签 JComboBox netWorkCard; // 选择网卡
JButton startCapture;// 开始捕获按钮 JLabel label3;// 地址信息标签
JTextField inputText3;// 文字输入框 JLabel label4;// MVC地址标签
JTextField inputText4;// 文字输入框 JLabel label5;// 网卡描述标签
JTextField inputText5;// 文字输入框 JPanel arpPanel;// 显示选择网卡
JPanel arpPane2;// 选择网卡输入框
JPanel arpPane3;// 地址信息
JPanel arpPane4;// MAC地址
JPanel arpPane5;// 网卡描述
JPanel pa;// 网卡描述
JPanel showPanel;// 显示效果区
JFrame f; public ArpGui() { super("解析ARP数据包"); // 选择网卡
arpPanel = new JPanel();
arpPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
label1 = new JLabel("     选择网卡");
arpPanel.add(label1); // 选择网卡输入框
arpPane2 = new JPanel();
arpPane2.setLayout(new FlowLayout(FlowLayout.CENTER));
netWorkCard = new JComboBox();
netWorkCard.setEditable(false);
startCapture = new JButton("开始捕获");
startCapture.addActionListener(this);
arpPane2.add(netWorkCard);
arpPane2.add(startCapture); // 地址信息
arpPane3 = new JPanel();
arpPane3.setLayout(new FlowLayout(FlowLayout.LEFT));
label3 = new JLabel("     地址信息            ");
inputText3 = new JTextField(40);
inputText3.setEditable(false);
arpPane3.add(label3);
arpPane3.add(inputText3); // MAC地址
arpPane4 = new JPanel();
arpPane4.setLayout(new FlowLayout(FlowLayout.LEFT));
label4 = new JLabel("     MAC地址            ");
inputText4 = new JTextField(40);
arpPane4.add(label4);
arpPane4.add(inputText4); // 网卡描述
arpPane5 = new JPanel();
arpPane5.setLayout(new FlowLayout(FlowLayout.LEFT));
label5 = new JLabel("     网卡描述            ");
inputText5 = new JTextField(40);
arpPane5.add(label5);
arpPane5.add(inputText5); pa = new JPanel();
pa.setLayout(new GridLayout(5, 1));
pa.add(arpPanel);
pa.add(arpPane2);
pa.add(arpPane3);
pa.add(arpPane4);
pa.add(arpPane5); // 设置容器;
Container container = getContentPane();
container.setLayout(new BorderLayout());
container.add(pa, BorderLayout.NORTH); setSize(600, 300);
setLocation(200, 200);
setResizable(false);
setVisible(true); } public void actionPerformed(ActionEvent e) {

if(e.getSource() == startCapture){} } public static void main(String[] args) { ArpGui ag = new ArpGui();
// 关闭窗口同时结束程序
ag.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
/*
 * 测试Jpcap
 */
package com.ccy.test;import jpcap.*;public class GetDevices { public GetDevices() {
} public static void ShowNeworkInterfaceDevices() {

// 获得网卡设备的实例列表
NetworkInterface[] devices = JpcapCaptor.getDeviceList();

// 循环输出全部网卡设备对象的相应信息
for (int i = 0; i < devices.length; i++) {

// 设备号、网卡名、网卡描述
System.out.println(i + ": " + devices[i].name + "("
+ devices[i].description + ")"); // 网卡所处数据链路层的名称与其描述
System.out.println(" datalink: " + devices[i].datalink_name + "("
+ devices[i].datalink_description + ")"); // 网卡MAC地址
System.out.println("MAC address:"); for (byte b : devices[i].mac_address)

// 转换为十六进制的字符串表示
System.out.println(Integer.toHexString(b & 0xff) + ":");
System.out.println(); for (NetworkInterfaceAddress a : devices[i].addresses)

// 输出网卡IP地址、IPV4/IPV6、子网掩码、广播地址
System.out.println(" address:" + a.address + " " + a.subnet
+ " " + a.broadcast); }
} public static void main(String[] args) {
ShowNeworkInterfaceDevices();
}
}