Methods Summary |
---|
public synchronized void | addActionListener(java.awt.event.ActionListener l)
actionListeners.addElement(l);
|
public synchronized java.lang.String | getBangText()
return text;
|
public synchronized int | getCircleSize()
return cSize;
|
public synchronized int | getFontSize()
return fontSize;
|
public synchronized java.awt.Color | getTextColor()
return tColor;
|
public static void | main(java.lang.String[] args)
BangBean2 bb = new BangBean2();
bb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e){
System.out.println("ActionEvent" + e);
}
});
bb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e){
System.out.println("BangBean2 action");
}
});
bb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e){
System.out.println("More action");
}
});
Frame aFrame = new Frame("BangBean2 Test");
aFrame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
aFrame.add(bb, BorderLayout.CENTER);
aFrame.setSize(300,300);
aFrame.setVisible(true);
|
public void | notifyListeners()
ActionEvent a =
new ActionEvent(BangBean2.this,
ActionEvent.ACTION_PERFORMED, null);
Vector lv = null;
// Make a copy of the vector in case someone
// adds a listener while we're
// calling listeners:
synchronized(this) {
lv = (Vector)actionListeners.clone();
}
// Call all the listener methods:
for(int i = 0; i < lv.size(); i++) {
ActionListener al =
(ActionListener)lv.elementAt(i);
al.actionPerformed(a);
}
|
public void | paint(java.awt.Graphics g)
g.setColor(Color.black);
g.drawOval(xm - cSize/2, ym - cSize/2,
cSize, cSize);
|
public synchronized void | removeActionListener(java.awt.event.ActionListener l)
actionListeners.removeElement(l);
|
public synchronized void | setBangText(java.lang.String newText)
text = newText;
|
public synchronized void | setCircleSize(int newSize)
cSize = newSize;
|
public synchronized void | setFontSize(int newSize)
fontSize = newSize;
|
public synchronized void | setTextColor(java.awt.Color newColor)
tColor = newColor;
|