How to Make a Form in Java

Java lets you create desktop applications that display forms for each section of the software. To create a new form, you call the "Frame" class. The Frame class creates a new form on the screen, and you can set up each control after the form is "drawn" on the user's screen. You must create a form variable for the new form to dynamically work with the form's properties.

Instructions

    • 1

      Right-click the Java source code file you want to use to create the new form. Click "Open With," then click the Java compiler you want to use to edit the application.

    • 2

      Create the new form. The following code creates a new form using the Frame class and adds the form to the "frm" variable:

      Frame frm=new Frame("My New Window");

    • 3

      Add controls to the form. The following example adds a label control to the form:

      Label mylabel = new Label("This is the label text:");

      frm.add(mylabel);

Related Searches:

References

Comments

Related Ads

Featured