FileDocCategorySizeDatePackage
SeederDialog.javaAPI DocExample1450Mon Feb 23 16:14:40 GMT 1998oreilly.jonathan.awt

SeederDialog

public class SeederDialog extends Dialog implements ActionListener, KeyListener

Fields Summary
ProgressBar
mProgressBar
Seeder
mSeeder
Constructors Summary
public SeederDialog(Frame parent, int seedBytes)

    super(parent, "Seeder Dialog", true);
    setupWindow(seedBytes);
  
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent ae)

 dispose(); 
public byte[]getSeed()

 return mSeeder.getSeed(); 
public voidkeyPressed(java.awt.event.KeyEvent ke)

public voidkeyReleased(java.awt.event.KeyEvent ke)

public voidkeyTyped(java.awt.event.KeyEvent ke)

    mProgressBar.setLevel(mSeeder.getCurrentBitIndex());
  
protected voidsetupWindow(int seedBytes)

    setFont(new Font("TimesRoman", Font.PLAIN, 12));
    setLayout(new GridLayout(4, 1));
    Label t1 = new Label("Please type some keys");
    Label t2 = new Label("to initialize the random");
    Label t3 = new Label("number generator.");
    add(t1);
    add(t2);
    add(t3);
    mProgressBar = new ProgressBar();
    Panel p = new Panel();
    p.add(mProgressBar);
    add(p);
    
    setSize(200, 200);
    setLocation(100, 100);
    pack();
  
    mSeeder = new Seeder(seedBytes);
    mProgressBar.setMaximum(mSeeder.getBitLength());
    mSeeder.addActionListener(this);
    
    t1.addKeyListener(mSeeder);
    t1.addKeyListener(this);
    t1.requestFocus();