import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author USUARIO
*/
public class DistribucionDeComponentes {
public static void main(String[] args) {
new Distribucion();
}
}
class Distribucion extends JFrame {
JPanel panel1;
JPanel panel2;
JPanel a;
Distribucion() {
setBounds(200, 200, 700, 600);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panel1 = new JPanel(new GridLayout(2, 0));
panel1.add(new JLabel("Coordenadas X "));
panel1.add(new JTextField("0.0"));
panel1.add(new JLabel("Coordenadas Y "));
panel1.add(new JTextField("1.0"));
panel2 = new JPanel(new FlowLayout());
panel2.add(new JButton("Calcular"));
add(panel1, BorderLayout.SOUTH);
add(panel2, BorderLayout.CENTER);
construirBotones();
add(a, BorderLayout.CENTER);
pack();;
setVisible(true);
}
void construirBotones() {
a = new JPanel(new GridLayout(5, 3));
JButton boton;
for (int i = 0; i < 20; i++) {
boton = new JButton("Aceptar");
boton.setSize(200, 200);
a.add(boton);
}
}
}