Mega Code Archive

 
Categories / Java Tutorial / Swing
 

Laying Out Components Using Absolute Coordinates

import javax.swing.JButton; import javax.swing.JPanel; public class Main {   public static void main(String[] argv) throws Exception {     JButton component = new JButton();     JPanel panel = new JPanel(null);     component.setBounds(1, 1, 100, 100);     panel.add(component);   } }