
//Use of drawString method to write onto a closable window
// This uses a different approach based on the graphics class and it's methods

import java.awt.*;

public class AppOutputFrame extends Frame// closable window

{
        public int x=3;
        public char c='C';
        public String s = "Output on the screen ";
        
        public static void main (String args[])
        
        {
                Frame square=new AppOutputFrame();
                square.setTitle("Output on The Screen");
                square.resize (250,250);
                square.show();
         }
         
         public void paint (Graphics g)
         
         {        //
                 g.drawString(s,100,100);
                 g.drawString("int x= " + x,100,120);
                 g.drawString("Char c = " + c,100,130);
                 g.drawString("Multiplication " + 2*x,100,150);
                 
          }
          
          // handler to close the window
          
          public boolean handleEvent(Event e)
          
          {
                  if(e.id==e.WINDOW_DESTROY)
                  
                  {
                          hide();
                          dispose();
                          System.exit(0);
                          return(true);
                          
                   }
            return super.handleEvent(e);
            
            }
            
}            
