Showing posts with label MAIN WINDOW. Show all posts
Showing posts with label MAIN WINDOW. Show all posts

Tuesday, 25 February 2014

WORKING WITH FRAME WINDOWS

HOW TO MAKE FRAMES(MAIN WINDOW)


How to Creating a frame window in an applet

   Creating a new frame window from within an applet is actually quite easy. First, create a subclass of Frame. Next, override any of the standard applet methods, such as init( ), start( ), and stop( ), to show or hide the frame as needed. Finally, implement the windowClosing( ) method of the WindowListener interface, calling setVisible(false) when the window is closed.After the applet, the type of window you will most often create is derived from Frame.

Frame’s constructors are as follows:

Frame( )
Frame(String title)

    The first form creates a standard window that does not contain a title.The second form creates a window with the title specified by title. We cannot specify the dimensions of the window. We must set the size of the window after it has been created. Some of the methods used when working with windows are as follows:

SETTING THE WINDOW'S DIMENSIONS:

The setSize( ) method is used to set the dimensions of the window.

Its signature is shown here:

                       void setSize(int newWidth, int newHeight)
                       void setSize(Dimension newSize)