FileDocCategorySizeDatePackage
BangBean.javaAPI DocExample5515Mon Apr 06 18:10:26 BST 1998bangbean

BangBean

public class BangBean extends Canvas implements Serializable

Fields Summary
protected int
xm
protected int
ym
protected int
cSize
protected String
text
protected int
fontSize
protected Color
tColor
protected ActionListener
actionListener
Constructors Summary
public BangBean()

    
    addMouseListener(new ML());
    addMouseMotionListener(new MML());
  
Methods Summary
public voidaddActionListener(java.awt.event.ActionListener l)

    if(actionListener != null)
      throw new TooManyListenersException();
    actionListener = l;
  
public java.lang.StringgetBangText()

 return text; 
public intgetCircleSize()

 return cSize; 
public intgetFontSize()

 return fontSize; 
public java.awt.DimensiongetPreferredSize()

    return new Dimension(200, 200);
  
public java.awt.ColorgetTextColor()

 return tColor; 
public static voidmain(java.lang.String[] args)

    BangBean bb = new BangBean();
    try {
      bb.addActionListener(new BBL());
    } catch(TooManyListenersException e) {}
    Frame aFrame = new Frame("BangBean 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 voidpaint(java.awt.Graphics g)

    g.setColor(Color.black);
    g.drawOval(xm - cSize/2, ym - cSize/2, 
      cSize, cSize);
  
public voidremoveActionListener(java.awt.event.ActionListener l)

    actionListener = null;
  
public voidsetBangText(java.lang.String newText)

    text = newText;
  
public voidsetCircleSize(int newSize)

    cSize = newSize;
  
public voidsetFontSize(int newSize)

    fontSize = newSize;
  
public voidsetTextColor(java.awt.Color newColor)

    tColor = newColor;