The Artima Developer Community
Sponsored Link

Java Answers Forum
2 quick ones

1 reply on 1 page. Most recent reply: Mar 24, 2005 7:38 AM by John Neale

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
cBin

Posts: 13
Nickname: cbb
Registered: Mar, 2005

2 quick ones Posted: Mar 24, 2005 6:56 AM
Reply to this message Reply
Advertisement
does anyone know what e.consume(); does? e is an event.
I couldn't find it in the java documentation.

does anyone know how to include all the java.lang.Math methods in a .java file? I tried

import java.lang.Math.*;


but it complains when I write something like sqrt(50.0);
as opposed to Math.sqrt(50.0);

it is just annoying to have to type Math.xxx in front of every Math method when you are using a lot of them


John Neale

Posts: 10
Nickname: rhino
Registered: Oct, 2003

Re: 2 quick ones Posted: Mar 24, 2005 7:38 AM
Reply to this message Reply
If you are using JDK 1.5 you can use the new static import mechanism to achieve this.

import static java.lang.Math.*;

You cannot do this is pre-1.5 releases.

It depends on the context of the consume() method. But if you imagine an event being fired to a linked list of objects then if an object in the list "consumes" the event then the event will not make it to the linked objects further down the list.

e.g. If it was a mouseevent and the first object in the list is a button then the button object will "consume" the event and the panel/frame/window/etc objects "below" the button will not be aware that a mouseevent occurred.

Flat View: This topic has 1 reply on 1 page
Topic: one more Question Previous Topic   Next Topic Topic: to DOM...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use