Created
January 28, 2011 03:44
-
-
Save blackraccoon000/799798 to your computer and use it in GitHub Desktop.
ComboBox7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package combotest; | |
import jpcap.JpcapCaptor; | |
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.ItemListener; | |
/** | |
* Created by IntelliJ IDEA. | |
* User: white | |
* Date: 11/01/28 | |
* Time: 7:15 | |
* To change this template use File | Settings | File Templates. | |
*/ | |
public class ComboBox7 extends JFrame { | |
public static void main(String args []){ | |
ComboBox7 frame = new ComboBox7(); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
frame.setBounds(10,10,300,200); | |
frame.setTitle("Title"); | |
frame.setVisible(true); | |
} | |
ComboBox7(){ | |
jpcap.NetworkInterface device[] = JpcapCaptor.getDeviceList();{ | |
String names[] = new String[device.length]; | |
for(int i = 0; i<names.length ;i++){ | |
names[i] = (device[i].description); | |
DefaultComboBoxModel model = new DefaultComboBoxModel(names); | |
JComboBox combo = new JComboBox(model); | |
combo.setPreferredSize(new Dimension(150,30)); | |
JPanel p = new JPanel(); | |
p.add(new JLabel("device")); | |
p.add(combo); | |
getContentPane().add(p,BorderLayout.CENTER); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment