TXT

Noname1

By Zachary Riley,2014-12-24 09:55
15 views 0
Noname1

import java.awt.*;

    import java.awt.event.*;

    import javax.swing.*;

public class Test1 extends JFrame implements ActionListener

    {

     JButton btn;

     JLabel lbl;

     public Test1(){

     super("?âÊÔ??Ìå");

     btn = new JButton("??Å?");

     lbl = new JLabel("ÔÙ?û");

     this.setLayout(new FlowLayout());

     this.add(lbl);

     this.add(btn);

     btn.addActionListener(this);

     this.setSize(200, 200);

     this.setVisible(true);

     this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);

     }

     public static void main(String[] args) {

     new Test1();

     }

     @Override

     public void actionPerformed(ActionEvent e) {

     JButton btn = (JButton)e.getSource();

     if(btn.getText().equals("??Å?")){

     if(lbl.getText().equals("ÔÙ?û")){

     lbl.setText("ÄãºÃ");

     }

     else{

     lbl.setText("ÔÙ?û");

     }

     }

     }

}

Report this document

For any questions or suggestions please email
cust-service@docsford.com