
Hi How SetBounds is used in java programs.The values in the setBounds refer to what? ie for example setBounds(30,30,30,30) and in that the four 30's refer to what ?

import java.awt.*;
import javax.swing.*;
class FrameExample
{
public static void main(String[] args)
{
JFrame f=new JFrame();
f.setLayout(null);
JLabel lab1=new JLabel("Name");
JLabel lab2=new JLabel("Age");
JTextField text1=new JTextField(20);
JTextField text2=new JTextField(20);
lab1.setBounds(10,10,100,20);
text1.setBounds(120,10,100,20);
lab2.setBounds(10,40,100,20);
text2.setBounds(120,40,100,20);
f.add(lab1);
f.add(text1);
f.add(lab2);
f.add(text2);
f.setVisible(true);
f.setSize(300,150);
}
}
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.