EVENT HANDLING - Java Codes

Mouse Drag Event

Description This code demonstrates how you can make dragging possible on your window using Mouse Motion Listener. Source Code import java.awt.*; import java.awt.event.*; import javax.swing.JFrame; ...

0 Comments. 1056 views since Aug 4, 2008

Event Tester

Description This is a code which shows various events working together like mouse clicked, mouse moved or component resized etc. Source Code import java.awt.*; import java.awt.event.*; import java.util ...

0 Comments. 1046 views since Aug 4, 2008

Key Responder

Description This is a code which shows response to various keystrokes. Source Code import java.awt.*; import java.awt.event.*; import javax.swing.*; public class KeyTester { static class MyActio ...

0 Comments. 944 views since Aug 12, 2008

Mouse Hit And Text Layout

Description This code shows a Text along with a Mouse Hit property with which you can reach a particular position in Text. Source Code import java.awt.Color; import java.awt.Dimension; import java.awt. ...

0 Comments. 936 views since Sep 4, 2008

Key Listener

Description This is a code in java showing the use of Key Listener event and ActionEvent with example of a simple editor Source Code import java.awt.AWTEventMulticaster; import java.awt.BorderLayout; imp ...

0 Comments. 935 views since Aug 11, 2008

Multicast Event

Description This is a code to show the multicast event with the help of Window. Source Code import java.awt.Container; import java.awt.event.*; import javax.swing.*; public class MulticastEvent extends ...

0 Comments. 916 views since Aug 3, 2008

Keyboard Flasher

Description This is a code sample which can flash your keyboard when you type. Source Code import java.awt.AWTEvent; import java.awt.Toolkit; import java.awt.event.AWTEventListener; import jav ...

0 Comments. 908 views since Jul 9, 2008

Swing Mouse Motion Event

Description This is a code in java which shows the use of swing Mouse Motion Event with look and feel by the help of a simple window which shows the event fired. Source Code import java.awt.Color; impor ...

0 Comments. 903 views since Aug 10, 2008

Mouse Wheel Event Demonstrator

Description This code demonstrates the Mouse Wheel Moved Event. It shows how the mouse wheel is tracked on moving it up and down. Source Code import java.awt.*; import java.awt.event.*; import jav ...

0 Comments. 877 views since Aug 4, 2008

Draw Cubic Curve using Mouse

Description It is java program which is used to draw the cubic curve on the applet window with the help of mouse Source Code import java.awt.*; import java.awt.event.*; import java.awt.geom.*; impo ...

0 Comments. 877 views since Dec 28, 2008

Key Event on Frame

Description This is a code that shows how key event are fired with simple example of drawing with keyboard Source Code import java.awt.Container; import java.awt.Graphics; import java.awt.Point; import j ...

0 Comments. 876 views since Aug 12, 2008

State Change Listener

Description This code shows how the system swithes from one state to other with small action of mouse. Source Code import java.awt*t; import java.awt.event.*; import javax.swing.*; import javax. ...

0 Comments. 813 views since Aug 12, 2008

Minimizing or Maximizing a Window

Description How to minimize or maximize a window Source Code import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.util.logging.Level; import java.util.logging ...

0 Comments. 809 views since Sep 3, 2008

Various Mouse Events

Description This is a simple code in java showing various mouse events being fired as mouse is moved on panel. Source Code import java.awt.Color; import java.awt.Dimension; import java.awt.GridBagConstra ...

0 Comments. 755 views since Aug 10, 2008

Customized Event: Progress Bar

Description This is a simple code in Java for showing the customized event i.e, The Status Bar. Source Code import java.awt.*; import java.awt.event.*; import java.util.EventListener; import javax. ...

0 Comments. 692 views since Aug 3, 2008