Quantcast
Channel: S. Nageswara Rao, Corporate Trainer – Way2Java
Browsing all 505 articles
Browse latest View live

Finding x and y Coordinates of Mouse Position in Java

We have seen earlier to handle mouse events separately with MouseListener and MouseMotionListener and also both listeners in a single program. Here also, both listeners are implemented but the task is...

View Article


Java Applet: MouseListener, MouseEvent, Mouse input Example

Note: Before going into this tutorial, it is advised to have better knowledge of Applet. What mouse events and key events possible with frame are also possible with applet because frame and applet are...

View Article


Applet Programming: MouseMotionListener Example

Note: Before going into this tutorial, it is advised to have better knowledge of Applet. Applets are also capable to raise mouse and key events like with frame. Following program illustrates how to use...

View Article

Applet Tutorial: Keyboard Input, Key Event, KeyListener

We have seen earlier to handle the mouse stable and mouse movement events with Applet. Now let us see with keyboard. A similar program is available with frame. In this simple program, depending on the...

View Article

Find X, Y Coordinates of Mouse Cursor Location in Java Applet

A similar program is available in frame – Finding x and y Coordinates of Mouse Position. The same frame program is converted to applet. Following is the example. The mouse cursor location in x and y...

View Article


Handling Mouse Events with MouseAdapter Example

1. What is MouseListener? We know, java.awt.event package comes with many event classes and listener interfaces to handle the events raised by AWT components like frame or button etc (known as semantic...

View Article

Java Made Clear: List of 7 Marker interfaces

Following table gives all the list of marker interfaces in Java. Maker interface name Functionality 1. java.io.Serializable the object is serialized 2. java.lang.Cloneable the object is cloned 3....

View Article

MouseMotionAdapter Simple Example Java

Adapters were introduced from JDK 1.1 to make event handling code easier. Adapters replace listener interfaces. The advantage of adapters over listeners is adapters allow the Programmer to override...

View Article


Java Tutorial: KeyAdapter and KeyEvent Simple Example

Java permits to handle low-level events of mouse and keyboard. For keyboard the java.awt.event package comes with KeyListener and KeyAdapter. KeyAdapter is an abstract class that replaces the usage of...

View Article


Java Applet: MouseEvent Handling with MouseAdapter Example

We have seen earlier a similar program Handling Mouse Events with MouseAdapter Example with an introduction to MouseAdapter, but the window here is frame. Let us do another program with applet window....

View Article

Applet: MouseMotionAdapter getX() and getY() Example

This is a good example to integrate classes. Two classes extending Applet and MouseMotionAdapter are integrated through their constructors with Composition – "has-a" relationship. Let us see the logic...

View Article

Applet: KeyAdapter with getKeyChar(), getKeyCode() Example

Note 1: Before going into this notes, if not aware of about adapter classes, It is advised to go through Java AWT Adapters. Note 2: For notes on integration of classes (it is done here also), refer...

View Article

View All for Mouse Listener/Adapter, Mouse Motion Listener/Adapter, Key...

Listener/Adapter With Frame With Applet MouseListener Handling MouseEvent MouseEvent, Mouse input Example MouseMotionListener Handling MouseEvent Example MouseMotionListener Example KeyListener Key...

View Article


Java Made Clear: What is SingleThreadModel in Servlets?

1. What is SingleThreadModel? It is an interface from javax.servlet package used with Servlets. It is marker interface having no methods. Few servlets may require this to implement. 2. Are Servlets...

View Article

Java Tutorial: Constructor with Example

The constructs (building blocks) of a Java class are variables, constructors, methods and some rarely used static blocks etc. 1. What is constructor or features of constructor? A constructor has the...

View Article


Java Tutorial: Constructor, Creation with Example

Constructors plays an important role in code development. A constructor looks like a method but without any return type. Moreover, the name of the constructor and class name should be the same. The...

View Article

Java this(): Calling Constructor from Constructor same class

We have seen earlier constructor overloading with example. In constructor overloading, multiple constructors exist within the same class. Generally, to call multiple constructors, we create multiple...

View Article


Java Made Clear: Difference between this and super Example

Basically, both this and super are keywords of Java performing different jobs. this keyword refers an object super keyword refers a super class variable or method A) Meaning, Purpose and Usage of this...

View Article

Java Made Clear: Difference between static and final Keywords

Both are known access modifiers in Java doing different functionalities (used for different jobs). static: static keyword can be applied to instance variables and methods but not to classes. When...

View Article

Java Made Clear: Difference between const and final Keywords

In Java, const is a reserved word (other only reserved word is "goto") and is not allowed to be used by Programmer in coding. const is supported by C/C++ and const is replaced by final keyword in Java....

View Article
Browsing all 505 articles
Browse latest View live