import java.applet.Applet;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

/* <APPLET CODE = "InteiroMaiorTela.class" WIDTH=250 HEIGHT=200></APPLET>*/

public class InteiroMaiorTela extends Applet implements ActionListener
{
Label titulo, legenda1, legenda2;
TextField caixa1, caixa2;
Button botao;
TextArea ta;
int x, y;

 public void init()
 {
	titulo = new Label("Qual é o maior número inteiro?");
	add(titulo);
	legenda1 = new Label("Forneça o primeiro número: ");add(legenda1);
	caixa1 = new TextField("",2);	 add(caixa1);
	legenda2 = new Label("Forneça o segundo número: ");add(legenda2);
	caixa2 = new TextField("",2);	 add(caixa2);
	botao = new Button("calcula o maior");; add(botao);
	botao.addActionListener(this);
	ta=new TextArea("",5,34); add(ta);
 }

  public void actionPerformed (ActionEvent e)
  {
	x=Integer.valueOf(caixa1.getText()).intValue();
	y=Integer.valueOf(caixa2.getText()).intValue();

	if(e.getSource()==botao)
	{
		ta.setText("");

		if (x==y) 	ta.append("\n valores iguais");
		else
		if (x>y)
		{
			ta.append("\n x é o maior valor ");
			ta.append("\n x= " + x);
		}
		else
		{
			ta.append("\n y é o maior valor ");
			ta.append("\n y= " + y );
		}
	}
  }
}

