pablosotol

Copiar valor

Aug 16th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.*;
  3. import java.awt.event.*;
  4.  
  5. public class Gui05 extends JFrame{
  6.  
  7. JButton botonCopiar;
  8. JTextField campoValor, resultado;
  9.  
  10. public Gui05(){
  11. setLayout(new FlowLayout());
  12. add(new JLabel("Valor"));
  13. campoValor=new JTextField(5);
  14. add(campoValor);
  15. botonCopiar=new JButton("Copiar);
  16. add(botonCopiar);
  17. botonCopiar.addActionListener(new OyenteBoton());
  18. add(new JLabel(" Copia "));
  19. resultado=new JTextField(6);
  20. setSize(400,100);
  21. setVisible(true);
  22. setDefaultCloseOperation(EXIT_ON_CLOSE);
  23. }
  24.  
  25. public static void main(String[] args){
  26.  
  27. Gui05 gui=new Gui05();
  28. }
  29.  
  30.  
  31. class OyenteBoton implements ActionListener(){
  32. @Override
  33. public void actionPerformed(ActionEvent e){
  34. String valor=campoValor.getText();
  35. resultado.setText(valor);
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment