
how to use Absolute Layout manager in java form ?

Hi Friend,
You can try the following code:
import java.awt.*;
import javax.swing.*;
public class SwingFrame{
public static void main(String[] args) throws Exception{
SwingFrame sf=new SwingFrame();
}
public SwingFrame(){
JFrame f = new JFrame("Frame in Java Swing");
f.getContentPane().setLayout(null);
JLabel lbl1 = new JLabel("Name");
JTextField jt1=new JTextField(15);
JLabel lbl2=new JLabel("Address");
JTextField jt2=new JTextField(15);
JButton b=new JButton("Submit");
lbl1.setBounds(100,120,70,20);
lbl2.setBounds(100,150,70,20);
jt1.setBounds(170,120,100,20);
jt2.setBounds(170,150,100,20);
b.setBounds(170,180,100,20);
f.add(lbl1);
f.add(lbl2);
f.add(jt1);
f.add(jt2);
f.add(b);
f.setSize(1000,1000);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
For more information, visit the following:
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.