Methods Summary |
---|
public synchronized void | addActionListener(java.awt.event.ActionListener l)
Vector v = actionListeners == null ? new Vector(2) : (Vector) actionListeners.clone();
if (!v.contains(l)) {
v.addElement(l);
actionListeners = v;
}
|
void | choiceChanged(java.awt.event.ItemEvent e)
if(e.getStateChange() == ItemEvent.SELECTED){
System.out.println("Selected Logic entered");
if(item1.isSelected())
fireActionPerformed(new ActionEvent(this, 1, "item1Selected"));
else if(item2.isSelected())
fireActionPerformed(new ActionEvent(this, 2, "item2Selected"));
else if(item3.isSelected())
fireActionPerformed(new ActionEvent(this, 3, "item3Selected"));
else if(item4.isSelected())
fireActionPerformed(new ActionEvent(this, 4, "item4Selected"));
else if(item5.isSelected())
fireActionPerformed(new ActionEvent(this, 5, "item5Selected"));
}
|
protected void | fireActionPerformed(java.awt.event.ActionEvent e)
if (actionListeners != null) {
Vector listeners = actionListeners;
int count = listeners.size();
for (int i = 0; i < count; i++)
((ActionListener) listeners.elementAt(i)).actionPerformed(e);
}
|
public int | getSelectedItem()
Enumeration e = bg.getElements();
int which = 0;
JRadioButton jr = null;
try{
while(e.hasMoreElements()){
which +=1;
jr = (JRadioButton)e.nextElement();
if( jr.isSelected() )
break;
}
}
catch(NoSuchElementException x){
x.printStackTrace();
return 0;
}
return which-1;
|
void | jbInit()
this.setLayout(gl);
bg.add(item1); bg.add(item2);
bg.add(item3); bg.add(item4);
bg.add(item5);
this.add(item1, null); this.add(item2, null);
this.add(item3, null); this.add(item4, null);
this.add(item5, null);
item1.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(ItemEvent e) {
choiceChanged(e);
}
});
item2.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(ItemEvent e) {
choiceChanged(e);
}
});
item3.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(ItemEvent e) {
choiceChanged(e);
}
});
item4.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(ItemEvent e) {
choiceChanged(e);
}
});
item5.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(ItemEvent e) {
choiceChanged(e);
}
});
|
public synchronized void | removeActionListener(java.awt.event.ActionListener l)
if (actionListeners != null && actionListeners.contains(l)) {
Vector v = (Vector) actionListeners.clone();
v.removeElement(l);
actionListeners = v;
}
|
public void | setSelectedItem(int which)
Enumeration e = bg.getElements();
JRadioButton jr = null;
int i = 0;
try{
for( ; i <= which; i++)
jr = (JRadioButton)e.nextElement();
}
catch(NoSuchElementException x){
x.printStackTrace();
}
jr.setSelected(true);
|