! You are not logged in to Prodigits. Please register or login.

Java - Topics

* Java > Topics


Subject: e.consume()
Replies: 3 Views: 16019

s_nd 9/14/2006 - 9:54:46
what does it really do, and how is it used? *

yamta 2/25/2007 - 10:56:41
e.consume(); is used to eliminate a keypad(keyboard) operation after a certain opereation. try this u may find out what i'm talking about; here we go import java.applet.*; import java.awt.*; import java.awt.event.*; public class Keyboard1 extends Applet implements KeyListener, MouseListener { int width, height; int x, y; String s = ''; public void init() { width = getSize().width; height = getSize().height; setBackground( Color.black ); x = width/2; y = height/2; addKeyListener( this ); addMouseListener( this ); } public void keyPressed( KeyEvent e ) { } public void keyReleased( KeyEvent e ) { } public void keyTyped( KeyEvent e ) { char c = e.getKeyChar(); if ( c != KeyEvent.CHAR_UNDEFINED ) { s = s + c; repaint(); e.consume(); } } public void mouseEntered( MouseEvent e ) { } public void mouseExited( MouseEvent e ) { } public void mousePressed( MouseEvent e ) { } public void mouseReleased( MouseEvent e ) { } public void mouseClicked( MouseEvent e ) { x = e.getX(); y = e.getY(); s = ''; repaint(); e.consume(); } public void paint( Graphics g ) { g.setColor( Color.gray ); g.drawLine( x, y, x, y-10 ); g.drawLine( x, y, x+10, y ); g.setColor( Color.green ); g.drawString( *

sroc 8/17/2007 - 2:46:07
Wow u hv coded here.. Gr8 work bro.. :) *

s_nd 30.12.07 - 09:22am
yamta clear off! lol. *


* Reply
* Java Forum


fav Bookmarks

Search:
topics replies


* Java (8)

Custom Search