-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFormularioEventos.java
More file actions
46 lines (34 loc) · 1003 Bytes
/
FormularioEventos.java
File metadata and controls
46 lines (34 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.applikdos;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class FormularioEventos extends JFrame implements ActionListener {
JButton boton1, boton2;
public static void main(String[] args) {
new FormularioEventos();
}
public FormularioEventos() {
setTitle("Formulario");
setSize(550, 250);
setLayout(null);
setVisible(true);
boton1 = new JButton();
boton1.setText("Aceptar");
boton1.setBounds(150, 100, 100, 30);
getContentPane().add(boton1);
boton1.addActionListener(this);
boton2 = new JButton();
boton2.setText("Cerrar");
boton2.setBounds(260, 100, 100, 30);
getContentPane().add(boton2);
boton2.addActionListener(this);
}
public void actionPerformed(ActionEvent evento){
if(evento.getSource()==boton1){
JOptionPane.showMessageDialog(null, "Este es el boton 1");
}
if(evento.getSource()==boton2){
JOptionPane.showMessageDialog(null, "Este es el boton 2");
}
}
}