Skip to main content

Posts

Showing posts from September, 2017

Mouse click example 1

                         Mouse click example Q. Write a Java program to define an applet , which will contain a label and when we click on the applet , the message will appear on the label. import java.applet.*; import java.awt.*; import java.awt.event.*; /*             <applet code="MouseDemo1" height=200 width=200>             </applet> */ public class MouseDemo1 extends Applet implements MouseListener {             Label lbl;             public void init( )             {    ...

Mouse event in Java

                     Mouse event in awt  Mouse The Mouse is handled using the listener known as the MouseListener. The MouseListener provides the various methods for handling the mouse events . 1. mousePressed( ) :             This method is called when the mouse is pressed . The general form is ,                         public void mousePressed(MouseEvent me)                         {                         //body of the method.  ...

Menu bar example with applet viewer in java

      Menu bar +applet viewer example-3 import java.applet.*; import java.awt.*;  /*   <applet code="MenuDemo" height=200 width=200>   </applet> */ public class MenuDemo extends Applet {             public void init( )             {                         Menus m = new Menus("Menu Bar Demo");                                    m.resize(200,200);       m.show();             } } class Menus extends Frame {             Menus(String s)             {                         super(s);                         Me...