Pilas
import java.awt.*;
import java.awt.Font.*;
import java.awt.event.*;
public class PilasEstaticas extends JFrame{
private JTextArea area;
private JScrollPane barra;private JButton agregar,eliminar,salir;
private JTextField texto;
public int arr[];
public int k=-1;
public final int max=5;
private int alto=500;
private int ancho=500;
public PilasEstaticas(){
//inicializacion de las variables refereciales
arr=new int[max];
//propiedades de las ventana
setTitle("Pilas Estaticas");
Toolkit kit=Toolkit.getDefaultToolkit();Dimension tamaniopantalla=kit.getScreenSize();
int anchopantalla=tamaniopantalla.width;
int altopantalla=tamaniopantalla.height;
setLocation((anchopantalla -ancho)/2,(altopantalla - alto)/2 );
setSize(ancho, alto);
setResizable(false);
getContentPane().setLayout(null);
//propiedades de JTextArea
area = new JTextArea(30,30);area.setEditable(false);
barra = new JScrollPane(area);
barra.setBounds(250,50,200,150);
getContentPane().add(barra);
// propiedades de boton
agregar= newJButton("Colocar");
agregar.setBounds(20,150,95,23);
getContentPane().add(agregar);
eliminar=new JButton("Retirar");
eliminar.setBounds(20,200,90,25);
getContentPane().add(eliminar);
salir=newJButton("Exit");
salir.setBounds(230,300,90,25);
getContentPane().add(salir);
//propiedades del campo de texto
texto=new JTextField();
texto.setBounds(20,100,120,25);getContentPane().add(texto);
ImageIcon icono = new ImageIcon("esta.jpg");
Image imagen = icono.getImage();
ImageIcon aescala = new ImageIcon(imagen.getScaledInstance(500,500,Image.SCALE_SMOOTH));
JLabel label3 = new JLabel (aescala);
add(label3);
label3.setBounds(0,0,500,500);
ActionListener accion= new java.awt.event.ActionListener()
{...
Regístrate para leer el documento completo.