Home TechnologyProgrammingJava Subscribe to RSS

What Is The Coding To Run The Frame Program In Java?

Answer Question

1 Answer - Sort by: Date | Rating

    HI
    to run Frame (window) in java, you need to develop an awt or swing application.
    There are certain steps you need to follow. Sequence of steps

    1. Import statements

    2. You need to exent the JFrame class, you can also implement actionlistener or any other event listener you want to use in your class

    a typical delcaration would be

    public class MyWindow extends JFrame implements ActionListener
    {
        //declare components as instance member

        //constructor to initialize components
        public MyWindow()
         {
              //set frame attributes
             
             //other components
           }

         //event handler
         public void actionPerformed(ActionEvent evt)
            {
                //handle actions here
            }

         //main method
        public static void main(String [] args)
             {
                   new MyWindow();
              }
    }

    This is basic template for a Frame Application in Java.

    Regards
    Farah Khan
    0 0

    Farahkhan  

    answered 5 months ago

      More

         
         

        Ask a Question via Twitter

        Send a question to @askblurtit and we will publish it online and send you a reply everytime you receive an answer.

        Blurtit Store

        Get T-shirts, hoodies, caps and more at the Blurtit store

        Blurtit International