package botonesappletflowlayout;
import java.awt.Color;
import java.awt.FlowLayout;
import javax.swing.JApplet;
import javax.swing.JButton;
/**
*
* @author Rafa
*/
public class BotonesAppletFlowLayout extends JApplet{
//declaramos los botones que mostraremos en el applet
private JButton boton1;
private JButton boton2;
private JButton boton3;
private JButton boton4;
public void init(){
//establecemos el tipo de composicion
setLayout(new FlowLayout());
//Creamos los botones
boton1 = new JButton("Boton1");
boton2 = new JButton("Boton1");
boton3 = new JButton("Boton1");
boton4 = new JButton("Boton4");
//Establece colores a los botones
boton1.setBackground(Color.green);
boton2.setBackground(Color.yellow);
boton3.setBackground(Color.red);
boton4.setBackground(Color.black);
//agregamos los botones al applet
add(boton1);
add(boton2);
add(boton3);
add(boton4);
}
public void start(){
//eventos(); //en caso que queramos crear eventos para los botones
}
}