MouseMotion on a class that's not an extended Component

Hi, i'm trying to make a class that has the addMouseMotion(MouseEvent e) on it, but i can't make it work, this class has nothing to do with the class componet so i can't use it.
I saw some people's code using a Vector of MouseMotionListener and implementing MouseMotion interface but i don't seem to make it work. Can someone help me out?
Here's the code:
class Whatever implements MouseMotionListener
Vector motionListeners = new Vector();
public void addMouseMotionListener(MouseMotionListener l)
motionListeners.add(l);
public boolean removeMouseMotionListener(MouseMotionListener l)
return motionListeners.remove(l);
public void mouseMove(MouseEvent e)
Enumeration e = motionListeners.elements();
((MouseMotionListener)e.nextElement()).mouseMove(e);
public void mouseDrag(MouseEvent e)
Enumeration e = motionListeners.elements();
((MouseMotionListener)e.nextElement()).mouseDrag(e);

From Enumeration javadoc:
NOTE: The functionality of this interface is duplicated by the Iterator interface. In addition, Iterator adds an optional remove operation, and has shorter method names. New implementations should consider using Iterator in preference to Enumeration.
From Iterator javadoc:
An iterator over a collection. Iterator takes the place of Enumeration in the Java collections framework. Iterators differ from enumerations in two ways:
* Iterators allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics.
* Method names have been improved.
The best thing you could do is to debug you app, either with System outputs or by using a debugger. E.g. there's a gui debugger integrated in JBuilder and propably in Forte, too.
Then you can step through your program.
Otherwise I needed more code relevant to this problem (where do you register an object of this class to a MouseMotion source? Where do you register other MouseMotionListeners to this object?).
Greets
Puce

Similar Messages

  • Accessing the ServletContext from a class that is not a Servlet?

    Is there any way of accessing the ServletContext from a class that is not a
              Servlet? The class is being used as part of a Web Application.
              Thanks.
              

    http://www.mozilla.org/mirrors.html
    Mozilla has download mirrors around the globe. If it is on the list, it is trustworthy.

  • Using custom classes that are not beans

    Hi folks,
    Is it possible to use java classes that are not beans. I mean, on a page, could you say Customer cust = new Customer("Jones", 25);
    if you had a Customer class with a constructor that took a name and age (String and int).
    If so, how do you go about this- do you need to import the class, or put it in a standard location? I'm using Tomcat, and would guess that this would go in WEB-INF/classes?
    I hope it's not a stupid question, all the literature seems to be focused on JavaBeans
    Any advice on this would be great!

    Beans are used as putting Java code into a JSP is generally considered bad practice. The advantage of the bean pattern is that you use things like:
    <jsp:setProperty name="laBean" property="someSetter" value="someValue" />so that you aren't embedding Java directly into the JSP. I'm not very religious about this particular topic personally and will throw a line or two in here and there.
    Having said that though, you can easily use any Java class in a JSP. You'll have to import it first:
    <%@ page import="java.util.*" %>And then you can easily use it like in a real Java program.

  • Can I convert a proxy for a class that does not has any interfaces?

    Can I convert a proxy for a class that does not has any interfaces?

    Hi.
    I can hardly understand your question: what do you want your proxy (what kind of proxy?) to be converted into?
    All I can tell you is the following: Proxies created using java.lang.reflect.Proxy can only be created using an interface. This interface has to be implemented by the proxied object. So: no interface, no java.lang.reflect.Proxy.
    Bye.

  • [svn:osmf:] 13401: PARB changes: removing nesting capabilities from MediaContainer, and introducing a separate MediaContainerGroup class ( that is not a MediaContainer) that now holds the functionality.

    Revision: 13401
    Revision: 13401
    Author:   [email protected]
    Date:     2010-01-09 07:37:48 -0800 (Sat, 09 Jan 2010)
    Log Message:
    PARB changes: removing nesting capabilities from MediaContainer, and introducing a separate MediaContainerGroup class (that is not a MediaContainer) that now holds the functionality.
    Modified Paths:
        osmf/trunk/apps/samples/framework/NestedMediaContainersSample/NestedMediaContainersSample .as
        osmf/trunk/framework/MediaFramework/.actionScriptProperties
        osmf/trunk/framework/MediaFramework/.flexLibProperties
        osmf/trunk/framework/MediaFramework/org/osmf/containers/HTMLMediaContainer.as
        osmf/trunk/framework/MediaFramework/org/osmf/containers/IMediaContainer.as
        osmf/trunk/framework/MediaFramework/org/osmf/containers/MediaContainer.as
        osmf/trunk/framework/MediaFramework/org/osmf/display/MediaPlayerSprite.as
        osmf/trunk/framework/MediaFrameworkFlexTest/org/osmf/MediaFrameworkTests.as
        osmf/trunk/framework/MediaFrameworkFlexTest/org/osmf/containers/TestMediaContainer.as
    Added Paths:
        osmf/trunk/framework/MediaFramework/org/osmf/display/MediaContainerGroup.as
        osmf/trunk/framework/MediaFrameworkFlexTest/org/osmf/display/TestMediaContainerGroup.as

    Hi,
    these concepts are used and implemented in jGuard(www.jguard.net) which enable easy JAAS integration into j2ee webapps across application servers.
    cheers,
    Charles(jGuard team).

  • Why does my web service web.xml reference a class that is not a servlet?

    In jDeveloper 10.1.3, I created the simplest web service I could think of. I created a HelloWorld class that has one method that accepts a name as a parameter and returns "Hello " + name. Using the wizards, I was able to get it to run just fine in my development environment. However, if I generate a WAR file and deploy it to Tomcat 5.5, it chokes on the web.xml. Here it is...
    <pre>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    <servlet>
    <description>Web Service MyHelloWorldServiceSoapHttpPort</description>
    <display-name>Web Service MyHelloWorldServiceSoapHttpPort</display-name>
    <servlet-name>MyHelloWorldServiceSoapHttpPort</servlet-name>
    <servlet-class>com.dex.b2b.HelloWorld</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>MyHelloWorldServiceSoapHttpPort</servlet-name>
    <url-pattern>MyHelloWorldServiceSoapHttpPort</url-pattern>
    </servlet-mapping>
    </web-app>
    </pre>
    The servlet-class value is my simple HelloWorld class, not a servlet. How is this suppose to run, if the servlet-class value is not a servlet? It certainly did not run in Tomcat 5.5. I can't get it to run on Oracle App Server 10.1.2 either.
    Thanks

    Hi fellrunningpictures-
    Picasa web albums shows you that message because they are not fully compatible with the latest version of Firefox. I would recommend contacting Picasa to encourage them to become fully compatible. I found a link for contacting them here:
    * [http://support.google.com/picasa/?hl=en http://support.google.com/picasa/?hl=en]
    Hope that helps.

  • Import classes that are not part of any package

    I have this problem with the JDK1.4 compiler:
    I have a few classes that were created outside of any package for some JNI uses. When I used JDK1.3 to compile, I was able to get the compiler to find these classes by doing the following in the calling classes:
    import ClassOutSideOfPackage;
    Now that I am trying to use JDK 1.4, the compiler complains with the following error:
    "." expected
    import ClassOutSideOfPackage;
    I tried to take the import out and had no luck. The compiler complained that it can't find this class. What can I do or is the only solution to change the class to include it in a package and change all relavant JNI native calls... etc. Thank you.

    Removing the entire import statement should work. Check for a classpath problem if it
    doesn't. It is not necessary to place in a package and recompile, though.I tried your suggestion. However, it keeps complaining that it can't find the class. The class file resides in the current directory and I have "." at the beginning of my class path. I don't see anything wrong with the classpath. Did you have this working?

  • Calling a function in another class that is not the App delegate nor a sngl

    Hi all-
    OK- I have searched and read and searched, however I cannot figure out an easy way to call a function in another class if that class is not the app delegate (I have that down) nor a singleton (done that also- but too much code)
    If you use the method Rick posted:
    MainView *myMainView = [[MainView alloc] init];
    [MyMainView goTell];
    That works, however myMainView is a second instance of the class MainView- I want to talk to the instance/Class already instantiated.
    Is there a way to do that without making the class a singleton?
    Thanks!

    I had some trouble wrapping my head around this stuff at first too.
    I've gotten pretty good at letting my objects communicate with one another, however I don't think my method is the most efficient or organized way but I'll try to explain the basic idea.
    When you want a class to be able to talk to another class that's initialized elsewhere, the class your making should just have a pointer in it to the class you want to communicate with. Then at some point (during your init function for example) you should set the pointer to the class you're trying to message.
    for example in the app-delegate assume you have an instance of a MainView class
    and the app-delegate also makes an instance of a class called WorkClass
    If you want WorkClass to know about MainView just give it a pointer of MainView and set it when it's instantiated.
    So WorkClass might be defined something like this
    //WorkClass.h
    @import "MainView.h"
    @interface WorkClass : NSObject
    MainView *myPointerToTheMainView;
    @property (retain) myPointerToTheMainView;
    -(void)tellMainViewHello;
    @end
    //WorkClass.m
    @import "WorkClass.h"
    @implementation WorkClass
    @synthesize myPointerToTheMainView;//this makes getter and setter functions for
    //the pointer and allows us to use the dot
    //syntax to refrence it.
    -(void)tellMainViewHello
    [myPointerToTheMainView hello]; //sends a message to the main view
    //assume the class MainView has defined a
    //method -(void)hello
    @end
    now somewhere in the app delegate you would make the WorkClass instance and pass it a reference to the MainView class so that WorkClass would be able to call it's say hello method, and have the method go where you want (to the single instance of MainView owned by the app-delegate)
    ex:
    //somewhere in app-delegate's initialization
    //assume MainView *theMainView exists and is instantiated.
    WorkClass *myWorkClass = [[WorkClass alloc] init];
    myWorkClass.myPointerToTheMainView = theMainView; //now myWorkClass can speak with
    // the main view through it's
    // reference to it
    I hope that gets the basic idea across.
    I'm pretty new to Obj-c myself so if I made any mistakes or if anyone has a better way to go about this please feel free to add
    Message was edited by: kodafox

  • Add HW Inventory class that does not exist in a default inventoried class

    Hello all, 
    I am trying to find a way to create a new class to supersede the win32_logicaldisk class. We are looking to add the VolumeDirty flag since it does not exist in the current SMS_logicaldisk class. However I cant seem to find a good way to do this. Has anyone
    done something like this before? Adding new classes doesn't seem to be difficult, but since this is a default WMI class that is being inventoried, I don't want to make any modifications to it as I know I will regret it down the road. I was thinking maybe creating
    a configuration item and inventorying it that way? Thoughts? Or is this even possible? Thanks in advance! 
    Scott

    I do similar things--create a new I-Made-It-Up class to pull in something that the default doesn't.  I understand and agree with not modifying default classes--it perhaps would never be a problem--but if (perhaps maybe) some future upgrade or cumulative
    update failed to install because you modified a default class, it could be a sad sad day.  :)
    If you want me to just write the mof edit for you, let me know.  Otherwise for a sample of how to do that; look at the mof edits for 'making up my own' SQL inventory:
    http://mnscug.org/blogs/sherry-kissinger/328-installed-sql05-sql08-sql12-sql14-version-information-via-configmgr-hardware-inventory
    Essentially, you make up a configuration.mof edit; making a 'copy of' what you really want out of win32_logicaldisk, but you dump it into a cm_scott_x_awesomeness  (or whatever you want to call it), and you put that at the bottom of configuration.mof
    on your server.
    Then your to-be-imported.mof into default client, hardware inventory, classes... import (if you're old skool, the sms_def.mof piece of it) will be a .mof file to inventory cm_scott_x_awesomeness
    Just be careful to name what you really want to see in v_gs_NameThatView inside the quotes SMS_Group_Name and SMS_Class_ID.  You'll be living with that table and view name forever, so maybe, perhaps, calling it Scott_X_Awesomeness just might not be
    the best name ever (although it sounds great right now, at review time w/the boss maybe not so much).
    Standardize. Simplify. Automate.

  • Adding data members and methods to generated classes that will not produce

    I want to use XMLBeans XMLObject for a project, but for the classes generated by XMLBeans, I want to add some additional data members and methods to handle program state that I do not want to have written out to an XML document.
    I have been using .NET's system.xml.XmlParser class, and it provides this sort of capability.
    In looking at the code produced by XMLObject, it looks possible.
    Question: Does anyone have any thoughts on the best way to accomplish what I want to do? Is there a good design pattern to follow?
    Question: Are there any gotchas in doing this? The only immediate one I can think of is that everytime the .java files are regenerated by XMLObject, I will have to reinsert my data members and methods.

    Hi Chuck,
    Setting the dispaly Field property should in no way affect your validation execution.
    The valiadtion if is working fine on the field value when it is not a display field it should do so when a display field as well.
    Besides if you are working on MDM main table all the main table fields are display fields.even if you do not set the property.As main table fields are always visible in MDM Data manager.
    Which version of MDM you are currently working on.
    As I have tried on the SP06 version on MDM and the  Null  validation runs fine on Display fields as well.
    Check your MDM version and also your MDM clients as well as MDM server be on the same version.
    What I am finding confusing here is that initially you wish to keep the material number as Blank for the approver to enter the material number which will be send through a mail.
    But the validation is checking for the material field to be balnk then how are you poulating the same field with Material number in the later stage.As it will fail the validation here.As per teh vlaidation it should remain blank as soon as someone enters a value it will throw an error.
    Or in either which wise you need to mainatin 2 valiadtion steps before and after the Approver for blank and filled field check.
    Just check your process flow correctly and the order of it in case that is causing the records to fail.
    Hope It Helped
    Thanks & Regards
    Simona Pinto

  • How to draw an Image on a BufferedImage in a class that is not a Component?

    I have an Image object loaded from a file using Toolkit, I want to draw it on a BufferedImage using g.drawImage( x, y, width, height, ImageObserver );
    later on I want to save the BufferedImage in a jpeg file using the converter.
    Since my class is not a subclass of Component (Panel, Applet, Canvas... ) what do I pass along as ImageObserver, nothing seems to be working, I can draw anything using g.draw... except an Image.
    Thanks...
    Fco. Espaillat

    Try extending ImageObserver. You only have to implement one method, and its hardly an implementation. I ussually have that method return true regardless of what is going on and it works.
    But to discourage bad programming style does anyone there know what that method is suppossed to return and how to find that out?

  • I'm getting classes that are not from JDBC Driver

    Hello
    I configured a data source connection against RAC using the oracle.jdbc.pool.OracleDataSource. When I get the connection and check what classes I'm getting I get the following:
    java.sql.Connection: com.evermind.sql.DriverManagerConnectionPoolConnection
    java.sql.PreparedStatement: com.evermind.sql.FilterPreparedStatement
    where I should be getting OraclePoolConnection and OraclePreparedStatement.
    Data Source:
    <data-source class="oracle.jdbc.pool.OracleDataSource" name="Test" locat
    ion="jdbc/Test" pooled-location="jdbc/pool/Test" username="seniat" password="seniat" url="jdbc:oracle:thin:@(DESCRIPTION = (LOAD_BALANCE = ON)(FAILOVER = ON)(ADDRESS = (PROTOCOL = TCP)(HOST = server1)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = server2)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = service)(failover_mode=(type=select)(method=basic)" max-co
    nnections="100" min-connections="10" inactivity-timeout="30"/>

    Launch System Preferences and select the Mail, Contacts, and Calendars tab. Now select each account that's listed and see which ones have a checkmark by notes.
    Your strange notes must be coming from one of these accounts. If you have only one account with Notes checkmark it must be that one. Change the password to that account. If you have more than one account with Notes you'll have to experiment to determine which one the notes are coming from or, of course, you could change the password for all the involved accounts.
    I can't think of any other way you would be getting notes into the notepad. (Unless someone is playing a prank and actually writing them while your computer is unattended)

  • Method in a class that should not be visible to outside class

    I am using Spring task executor and I have a service that has two method.
    public SpringTaskExecutor implement SpringExecutor {
    List<Info> infos;
    //called by spring to poll the db after every 10 mts
    public pollDatabaseAfterEveryTenMinute(){
    .infos= new ArrayList<Info>();
    infos.add....
    //called by other class to get polling details
    public List<Infor> getInfoOfTeam(){
    return infos;
    But I want to make pollDatabaseAfterEveryTenMinute as private or protected so that only Spring can call it ,but no one else.
    Unfortunately I cannot make it private/protected because I implement an interface and spring will not find if I dont define the method in the interface.The second alternative is not to implement the interface.
    Please tell me if I have any other alternative

    You can't. There is no syntax for 'only Spring can call this method'. Spring has defined the method in an interface, so it is public, so anybody can call it.

  • How to import a class that have no package

    I have .class archive that i need to use in a web aplication on Tomcat. I put the class in the directory: <webapp>/WEB-INF/classes/.
    The class doesn�t have a package, so when i tried to import (..page Import=".....") it, tomcat gave me an error because is looking for a package instead of the class.
    then i try to use it without the import and tomcat gave another error because it can�t find the class.
    Any ideas??
    by the way.. I don�t have the source code, I just have the .class archive..
    thank you....

    Also, I already found that the class had no package. Then you are out of luck.
    As of java 1.4 you can no longer import classes that are not in a package. [url http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=c85f07c1ce8f344d787b7a5146d68:WuuT?bug_id=4361575 ] Full details here
    The only solutions I can think of
    1 - get the people who originally gave you the class to package it properly.
    2 - Decompile it to java code, Change the java code to put it in a package and recompile it. Depending on the complexity of the class this may or may not be a trivial operation.
    Good luck,
    evnafets

  • Error 1119 when class extends another class that extends movieclip

    hiya
    i came across this problem and i have no clue why it's happening. basically, consider 2 nested movieclips on the stage, something like stage -> main -> filler.  both movieclips have instance names (main and filler).
    in the library, i set main to export for actionscript, using class A:
    package {
        import flash.display.MovieClip;
        public class A extends MovieClip {     
            public function A ():void {
                trace ('construct A');
                trace (this.filler); // should trace [movieclip] etc
    it works fine. now i change it's export settings to use class B, that extends A, and it breaks:
    package {
        import flash.display.MovieClip;
        public class B extends A {
            public function B ():void {
                trace ('construct B');
    this throws an error 1119: Access of possibly undefined property filler through a reference with static type A.
    can anyone give me a hint on that, as it works with class A, but not B extending A? i understand it was meant to work?
    many thanks

    afaik, if you dont declare super(), flash will make a call for you (but best practice is to call it always).
    but i found the "solution" in another forum.
    it seems that flash implicitly generates variables if you have instance names/symbols on the stage. there is an option to disable that under publish settings -> Actionscript version -> Settings -> automatically declare stage instances. by disabling that, we were able to declare public var filler:MovieClip; on class A, and that worked.
    although, that solution doesnt look attractive to me. the other solution posted on another forum was to make calls to this ["filler"] instead of this.filler. that seems to work fine. i guess it has to do with the automatic variable generated thing.. who knows?
    i hope that helps someone else too

Maybe you are looking for

  • After update, Garageband won't detect midi keyboard.

    After upgrading to Lion, Garageband won't detect my midi keyboard. I've already scanned for it in the Audio midi utility. It worked fine before the update. Does anyone know a solution?

  • Query Please Urgent

    SELECT DISTINCT icms_task_assigned.task,icms_task_department.task_department,icms_assigned_to.assigned_to,to_char(icms_task_assigned.target_date,'DD-Mon-YYYY') AS target_date,call_status,icms_task_assigned.remarks,icms_task_assigned.task_id FROM icms

  • Capturing ENTER key in WD4A

    Hi all, I m getting an input from the user in an Inputfield. I also have a table with two columns. The textfield is used to perform wildcard search (filter) for the table. That is, if i give a character like 'A', then the records which start with the

  • Authentication on device

    Hi everybody, Please help me. I'm using actionscrip 2 and FlashLite 2.x. I write an application which connect to server to login and use authentication. I use addRequestHeader function of XML object as the following:      var xml:XML = new XML();    

  • Why do we have to re-register Office 365 every time we use one of the applications?

    We purchased the 5 user package and 1st and 2nd machines seem to work fine and do not require logging into the cloud to use the products, but on the third one we have to register the products every time we try to use it.  The pc having the issue is r