// VENTANA CON COMPONENTES import java.awt.event.*; import javax.swing.*; import java.awt.*; public class Ventana extends JFrame { JButton OK = new JButton("OK"); JLabel LX = new JLabel("X"); JLabel LY = new JLabel("Y"); JTextField TF_X, TF_Y; int X=0, Y=0; JPanel Grafico, Control; public static void main(String ARGS[]) { new Ventana(); } public Ventana() { this.setLayout( null ); this.setBounds(100, 100, 600, 600); this.setVisible(true); Control = new JPanel(); this.add(Control); Control.setLayout(null); Control.setBackground(Color.blue); Control.setBounds(10, 500, 500, 50); Control.add(OK); OK.setBounds(400, 1, 100, 30); Grafico = new JPanel(); this.add(Grafico); Grafico.setLayout(null); Grafico.setBackground(Color.yellow); Grafico.setBounds(1, 1, 598, 450); } protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) System.exit(0); } }