Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5.  
  6. /**
  7. *
  8. * @author rabbit
  9. */
  10.  
  11. import javax.swing.JLabel;
  12. import javax.swing.JFrame;
  13. import javax.swing.JButton;
  14. import java.awt.event.*;
  15.  
  16.  
  17.  
  18.  
  19. public class HelloWorldFrame extends JFrame implements ActionListener{
  20. JLabel jlbLabel1= new JLabel();
  21. JLabel jlbLabel2= new JLabel();
  22. JButton jbtMyButton =new JButton();
  23.  
  24. public static void main(String args[])
  25. {
  26. new HelloWorldFrame();
  27.  
  28. }
  29.  
  30. HelloWorldFrame(){
  31. FlowLayOut floMyLayout =new FlowLayout();
  32. setLayout(floMyLayout);
  33.  
  34. jlbLabel1.setText("Hello");
  35. jlbLabel2.setText("Whatever");
  36. jbtMyButton.setText("Hello");
  37.  
  38.  
  39. add(jlbLabel1);
  40. add(jlbLabel2);
  41. add(jbtMyButton);
  42. jbtMyButton.addActionListener(this);
  43.  
  44. this.setSize(100,100);
  45. setVisible(true);
  46.  
  47. public void actionPerformed(ActionEvent e){
  48.  
  49. jlbLabel1.setText("Pressed");
  50.  
  51. }
  52.  
  53.  
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement