Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author rabbit
- */
- import javax.swing.JLabel;
- import javax.swing.JFrame;
- import javax.swing.JButton;
- import java.awt.event.*;
- public class HelloWorldFrame extends JFrame implements ActionListener{
- JLabel jlbLabel1= new JLabel();
- JLabel jlbLabel2= new JLabel();
- JButton jbtMyButton =new JButton();
- public static void main(String args[])
- {
- new HelloWorldFrame();
- }
- HelloWorldFrame(){
- FlowLayOut floMyLayout =new FlowLayout();
- setLayout(floMyLayout);
- jlbLabel1.setText("Hello");
- jlbLabel2.setText("Whatever");
- jbtMyButton.setText("Hello");
- add(jlbLabel1);
- add(jlbLabel2);
- add(jbtMyButton);
- jbtMyButton.addActionListener(this);
- this.setSize(100,100);
- setVisible(true);
- public void actionPerformed(ActionEvent e){
- jlbLabel1.setText("Pressed");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement