Janice,

In my project (Texas Hold'em poker game) I have an about button
element called "about" that has the register listener following line
in Java:

        pokerTable.registerListener("about","click",new DisplayAbout());

which calls the following method in my PokerTable (Main GUI) class:

        public void registerListener(String element,String
action,EventListener listener)
        {
                try
                {
                        Element elt = doc.getElementById(element);
                        EventTarget t = (EventTarget)elt;
                        t.addEventListener(action,listener,false);
                }catch(Exception ex)
                {
                        System.out.println("Error whilst registering Listener: 
"+ex.getMessage());
                }
        }

then my DisplayAbout EventListener does this:

    public class DisplayAbout implements EventListener {
        public void handleEvent(Event evt) {
            Thread displayThread=new Thread(){
                public void run(){
                    try{
                        SplashScreen splash=new SplashScreen();
                        splash.setVisible(true);
                        }
                        catch (Exception ex)
                        {
                    System.out.println("An error with the poker client has
occured: "+ex.getMessage());
                        }
                }
              };
        displayThread.start();
        }
    }

So basically my method assigns a click EventListener on an XML element
in the document.

Rinse and repeat for other elements/eventlisteners. I love how simple
and consequently how quick it is to expand :)

Hope this helps,

Lewis Keen
Final Year, Software Engineering
De Montfort University, Leicester

On 4/25/06, janice tan <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> am trying to implement a java application and have been trying to make use
> of the batik plugin with eclipse. i have been sucessful in creating a svg
> document for a bar chart and adding it to a JSVGCanvas to display. however,
> i would like to make my svg interactive and would need to include some
> mouseevents, linking and even loading anotehr svg on top.
> i have previously managed to do this in javascript. but am not sure if its
> possible through java.
>
> thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to