import java.awt.*;
import java.applet.*;
import java.awt.event.*;
class RBDialog extends Dialog implements ActionListener{
	int RB;
	bjt_evirici_1 aplet;
	TextField RBdegeri = new TextField(3);
	Label RBbaslik = new Label("RB = ");
	Panel butun = new Panel();
	String yeniayarla = new String("");
	
	public RBDialog(bjt_evirici_1 aplet) {
		super(getFrame(aplet),"RB");
		this.aplet=aplet;
		setBackground(Color.white);
		setLayout(new BorderLayout());
		
		RBdegeri.addActionListener(this);
		butun.setLayout(new FlowLayout(FlowLayout.LEFT));
		butun.add(RBbaslik);
		butun.add(RBdegeri);
		add(butun,"Center");
	}
	
	public void actionPerformed(ActionEvent olay){
		TextField alan = (TextField)olay.getSource();
		try{	
			if(Integer.parseInt(alan.getText())!=0){
				RB = Integer.parseInt(alan.getText());
				alan.setText(yeniayarla);
				dispose();
				aplet.RBguncelle(RB);
			}
		}
		catch(NumberFormatException e){
			alan.requestFocus();
			alan.selectAll();
		}
	}
	
	static Frame getFrame(Component c) {
		Frame     frame = null;

        while((c = c.getParent()) != null) {
            if(c instanceof Frame)
                frame = (Frame)c;
        }
        return frame;
    }
	
	public Dimension getPreferredSize(){
		return new Dimension(110,80);
	}
}