public void setBounds(int x,int y,int width,int height)
- x defines the x co-ordinate of componet
- y defines the y co-ordinate of componet
CODING:
import javax.swing.*;import java.awt.*;
class tab extends JFrame
{
JButton jb;
tab()
{
super();
setTitle("SetBounds Example");
setSize(400, 300);
setVisible(true);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jb =new JButton("BUTTON");
setLayout(null);
jb.setBounds(300, 150, 200, 200);
add(jb);
}
}
class nbutt
{
public static void main(String args[])
{
tab x= new tab();
}
}
No comments:
Post a Comment