Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.*;
- import java.awt.event.*;
- public class Gui05 extends JFrame{
- JButton botonCopiar;
- JTextField campoValor, resultado;
- public Gui05(){
- setLayout(new FlowLayout());
- add(new JLabel("Valor"));
- campoValor=new JTextField(5);
- add(campoValor);
- botonCopiar=new JButton("Copiar);
- add(botonCopiar);
- botonCopiar.addActionListener(new OyenteBoton());
- add(new JLabel(" Copia "));
- resultado=new JTextField(6);
- setSize(400,100);
- setVisible(true);
- setDefaultCloseOperation(EXIT_ON_CLOSE);
- }
- public static void main(String[] args){
- Gui05 gui=new Gui05();
- }
- class OyenteBoton implements ActionListener(){
- @Override
- public void actionPerformed(ActionEvent e){
- String valor=campoValor.getText();
- resultado.setText(valor);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment