-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHComboBox.java
More file actions
56 lines (47 loc) · 921 Bytes
/
HComboBox.java
File metadata and controls
56 lines (47 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package javaCMS;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
public class HComboBox extends JComboBox
{
ArrayList IDandName;
public HComboBox()
{
IDandName = new ArrayList();
}
/*public void setIds(int[] ids)
{
this.ids = ids;
}*/
public void populateBox(ArrayList items)
{
for(Object item : items)
{
addItem((String)item);
}
}
public void populateBoxFrData(ArrayList items)
{
for(Object ob : items)
{
IDandName.add((String[]) ob);
addItem(((String[])ob)[1]);
}
for(Object s : IDandName)
{
System.out.println(((String[])s)[0].toString());
}
}
public int getSelectedItemID()
{
String item = (String) getSelectedItem();
for(Object ob : IDandName)
{
if(((String[])ob)[1].equals(item))
{
return Integer.parseInt(((String[])ob)[0]);
}
}
return -200;
}
}