Source Code : Without layout manager, we position components using absolute values.

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Without layout manager, we position components using absolute values.

     

import javax.swing.JButton;
import javax.swing.JFrame;

public class Absolute {
  public static void main(String[] args) {
    JFrame f = new JFrame();
    f.setLayout(null);

    JButton ok = new JButton("OK");
    ok.setBounds(50, 150, 80, 25);

    JButton close = new JButton("Close");
    close.setBounds(150, 150, 80, 25);

    f.add(ok);
    f.add(close);

    f.setSize(300, 250);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
  }
}

   
    
    
    
    
  

Thank with us