|
||||
|
Java Programming - how to implement a Mouse Listener effectively?
Okay, so I'm just wondering how to implement a MouseListener on a class that I'm writing. Pretty much, I have some class, say SimpleCanvas, a stripped down version of Canvas.java
This SimpleCanvas has a method called "addMouseListener (MouseListener ml)" I've told another class which is calling SimpleCanvas to implement MouseListener; my question is: How do the MouseEvents work? If SimpleCanvas is defined in a Cartesian-like co-ordinate system, and I want the MouseClicked (MouseEvent e) to work by checking where the mouse was clicked, relative to SimpleCanvas' co-ordinate system, how would I do so? e.getX() and e.getY()? Or something else? Sorry if this sounds kinda stupid. I suck at programming. ![]() Cheers ~read~
__________________
Dansa med oss! Klappa era hдnder! Gцr som vi gцr Ta nеgra steg еt vдnster! Lyssna och lдr Missa inte chansen Nu дr vi hдr med ![]() Caramelldansen! |

|
||||
|
Re: Java Programming - how to implement a Mouse Listener effectively?
ahh don't worry. I figured out that I forgot to implement all the functions for MouseListener when I was saying my class implements MouseListener. Kinda silly of me, that's what I get for being a first-timer...^^
~read~
__________________
Dansa med oss! Klappa era hдnder! Gцr som vi gцr Ta nеgra steg еt vдnster! Lyssna och lдr Missa inte chansen Nu дr vi hдr med ![]() Caramelldansen! |

|
||||
|
Re: Java Programming - how to implement a Mouse Listener effectively?
Let me guess, just one of those lines you overlooked? Don't worry, happens to me all the time. My dad's been doing this for about 5 years now and does the same thing. Matter of curiosity, what are you compiling with? And did you know you can do the same thing with Visual Basic and AJAX in a few minutes?
|

| Advertisement |
|
||||
|
Re: Java Programming - how to implement a Mouse Listener effectively?
Uni stuff, mate.
I've never programmed before, so we're using a very basic IDE. BlueJ, it's called. *waits for the laughs from all the proper comp people* I actually didn't realise how to use the MouseListener properly until I'd read the specs and got some help with it again. It wasn't integral to the assignment, either, but it makes it more fun to do. I don't know how to use Basic or AJAX as I haven't learnt either: I start C and more Java in July. Expect more painful posts (or embarassing moments for me) then. ![]() ~read~
__________________
Dansa med oss! Klappa era hдnder! Gцr som vi gцr Ta nеgra steg еt vдnster! Lyssna och lдr Missa inte chansen Nu дr vi hдr med ![]() Caramelldansen! |

|
||||
|
Re: Java Programming - how to implement a Mouse Listener effectively?
AJAX isn't a true language, it's more of an object that can be implemented in a simple EventHandler with C# or VB (if you can do it in C#, you can do it VB, they're vice versa languages). But if you can get ahold of you student info, you can apply as a student at JourneyEd with your Windows Live ID and can get professional compilers (VS 2008, Expression, etc.) from Microsoft through Dreamspark. Before the thread gets closed, you can talk to me about programming on the board for a group (Programmers of the World, yea it's mispelled, but I'm not an English major) and I think Dog Dog (can't remember names to well) knows Java more than I do so you can talk to Dog for some help.
|

| Advertisement |
|
||||
|
Re: Java Programming - how to implement a Mouse Listener effectively?
Quote:
Not to come off as rude, but how does that tie into Java? |

|
|||
|
Re: Java Programming - how to implement a Mouse Listener effectively?
Недавно набрёл на статью о электроинструменте - в частности о шлейф машинке. Было написано много всего хорошего и плохого, мол, удобно, практично...
Но не сказано самого главного! На днях при работе у меня в такой агрегат (пример тут) зажевало провод собственного питания. Разумеется сразу КЗ, искры, дым... Хорошо, что выбило только пробки... Всё обошлось...
__________________
altai-city |

| Advertisement |
|
|||
|
Re: Java Programming - how to implement a Mouse Listener effectively?
Programming can be quite difficult. You might check the Java forum at Sun.
There is a section for beginners.
__________________
- I pass the time - Game Site - http://www.domo-sudoku.com Game Blog - http://domomaster.blogspot.com |

|
|||
|
Re: Java Programming - how to implement a Mouse Listener effectively?
Quote:
__________________
![]() |

| Advertisement |
|
||||
|
Re: Java Programming - how to implement a Mouse Listener effectively?
What? How does using VB or the Ajax tools make you stupid? seriously it's just a different language that's a little easier to control than Java, and AJAX is java, it's just reconfigured so you can use VB to control it
|

![]() |
| Tags |
| effectively, implement, java, listener, mouse, programming |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|