/* Program : 22 Develop a Java application to demonstrate the use of adapter classes Developed by : Malhar Vora Developed on : 11-11-2010 Development Status : Completed and tested Email : vbmade2000@gmail.com WebSite : www.malhar2010.blogspot.com *******************************************************************************************************************/ import javax.swing.*; import java.awt.event.*; public class P22 extends JFrame { JLabel lblMsg=null; P22() { setSize(400,300); setTitle("Prorgam 22 - Developed by Malhar Vora"); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); setLayout(null); lblMsg = new JLabel("Message will be displayed here"); lblMsg.setBounds(10,10,300,100); this.getContentPane().add(lblMsg); MouseHandler mHandle = new MouseHandler(); addMouseListener(mHandle); } class MouseHandler extends MouseAdapter { public void mousePressed(MouseEvent me) { lblMsg.setText("Mouse Pressed"); } public void mouseReleased(MouseEvent me) { lblMsg.setText("Mouse Released"); } } public static void main(String []str) { P23 p = new P23(); } }
Thursday, November 18, 2010
Develop a Java application to demonstrate the use of adapter classes
Labels:
Java
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.