by Dinesh Thakur Category: AWT and Applets

How does Java come to know where to place the component into the container. One possible way is to tell it manually. By manually, we mean that you have to specify the size and position of each component yourself.

import java.awt.*;

class setLayoutExample extends Frame
            Label lblRollno = new Label("Rollno : ");
            TextField txtRollno = new TextField(15);
            add(lblRollno); add(txtRollno);   
   class setLayoutJavaExample
        public static void main(String args[])
           setLayoutExample frame = new setLayoutExample();
           frame.setTitle("Manually setLayout in Java Example");

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles