/** Rooma numbrid (4p) * Etteantud arv vahemikus 1-10 v2ljastatakse rooma numbrina */ import java.applet.Applet; import java.awt.*; import java.awt.font.*; import java.awt.event.*; public class HillarpEksam23 extends Applet implements ActionListener{ int nr1=1; //- String[] RoomaYhelised={"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"}; static int raamX=100, raamY=100; TextField tf1=new TextField("1"); public HillarpEksam23(){ add(tf1); tf1.addActionListener(this); } //- end of HillarpEksam2() public void actionPerformed(ActionEvent e){ nr1=Integer.parseInt(tf1.getText().trim()); repaint(); } //- end of actionPerformed public void paint(Graphics g){ g.setColor(Color.black); //texti v2rv mustaks if ((nr1<1) || (nr1>10)){ g.drawString("Pole vőimalik", 10, 50); }else{ g.drawString(RoomaYhelised[nr1-1]+"", 10, 50); } //- end if } //-end of paint public static void main(String argumendid[]){ Frame f=new Frame("Rooma numbrid"); f.setSize(raamX, raamY); f.add(new HillarpEksam23()); f.setVisible(true); } //- end of main } //- end of class