Está en la página 1de 1

Con este ejercicio se puede trabajar:

 Respuestas en ventana emergente

 Capturar información del usuario

 Manejo del color del panel y del fondo

Package rectángulo;
import javax.swing.plaf.ColorUIResource;
import javax.swing.*;
public class Main {
public static void main(String[] args) {
UIManager uim = new UIManager();
UIManager.put("OptionPane.background", new ColorUIResource(233,132,254));
UIManager.put("Panel.background", new ColorUIResource(250, 250, 150));
{
{
int total, d1, d2;
String s;
s=JOptionPane.showInputDialog("ingrese primer número:");
d1 = Integer.parseInt(s);
s=JOptionPane.showInputDialog("ingrese segundo número:");
d2 = Integer.parseInt(s);
total=d1+d2;
JOptionPane.showMessageDialog(null,"el resultado es: "+total);
}
}
}
}

También podría gustarte