Calendar Awards Members List FAQ
Advertisement
Play-Asia.com - Buy Video Games for Consoles and PC - From Japan, Korea and other Regions
Reply
$ Thread Tools
 
  #1 (permalink)   [ ]
Old 05-02-2009, 03:33 AM
The Readeemer The Readeemer is offline
Zora Warrior
Join Date: Feb 2009
Location: Oh...
View Posts: 265
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!
Reply With Quote
  #2 (permalink)   [ ]
Old 05-26-2009, 10:33 AM
ipwxy ipwxy is offline
Deku Scrub
Join Date: May 2009
View Posts: 3
Re: Java Programming - how to implement a Mouse Listener effectively?

Post your methods for getY and getX
Reply With Quote
Advertisement
  #3 (permalink)   [ ]
Old 05-30-2009, 08:35 AM
The Readeemer The Readeemer is offline
Zora Warrior
Join Date: Feb 2009
Location: Oh...
View Posts: 265
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!
Reply With Quote
  #4 (permalink)   [ ]
Old 06-02-2009, 09:24 AM
The Farmboy The Farmboy is a male United States The Farmboy is offline
...
Join Date: Jan 2008
Location: just leave me alone
View Posts: 425
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?
__________________

Reply With Quote
Advertisement
  #5 (permalink)   [ ]
Old 06-02-2009, 10:55 AM
The Readeemer The Readeemer is offline
Zora Warrior
Join Date: Feb 2009
Location: Oh...
View Posts: 265
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!
Reply With Quote
  #6 (permalink)   [ ]
Old 06-02-2009, 09:54 PM
The Farmboy The Farmboy is a male United States The Farmboy is offline
...
Join Date: Jan 2008
Location: just leave me alone
View Posts: 425
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.
__________________

Last Edited by The Farmboy; 06-02-2009 at 09:57 PM. Reason: Reply With Quote
Advertisement
  #7 (permalink)   [ ]
Old 06-23-2009, 10:05 PM
The Farmboy The Farmboy is a male United States The Farmboy is offline
...
Join Date: Jan 2008
Location: just leave me alone
View Posts: 425
Re: Java Programming - how to implement a Mouse Listener effectively?

Quote:
Originally Posted by hijk721 View Post
Y-3 and the latest in denim jeans and designer clothing online.
WTF? Not to come off as rude, but how does that tie into Java?
__________________

Reply With Quote
  #8 (permalink)   [ ]
Old 06-29-2009, 11:41 AM
altai-city altai-city is offline
Deku Scrub
Join Date: Jun 2009
View Posts: 1
Re: Java Programming - how to implement a Mouse Listener effectively?

Недавно набрёл на статью о электроинструменте - в частности о шлейф машинке. Было написано много всего хорошего и плохого, мол, удобно, практично...
Но не сказано самого главного! На днях при работе у меня в такой агрегат (пример тут) зажевало провод собственного питания.
Разумеется сразу КЗ, искры, дым... Хорошо, что выбило только пробки... Всё обошлось...
__________________
altai-city
Reply With Quote
Advertisement
  #9 (permalink)   [ ]
Old 06-30-2009, 05:07 AM
carolina17 carolina17 is a female United Kingdom carolina17 is offline
Deku Scrub
Join Date: Jun 2009
View Posts: 11
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
Reply With Quote
  #10 (permalink)   [ ]
Old 07-06-2009, 07:42 AM
8bit 8bit is a male United States 8bit is offline
Just keep saying to yourself, "I'm adequate."
Join Date: Aug 2004
Location: Murphysboro, Illinois
View Posts: 4,183
Re: Java Programming - how to implement a Mouse Listener effectively?

Quote:
Originally Posted by The Farmboy View Post
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?
You can also bang your head against a brick wall. I'm not sure why you'd do either, though, as they both make you look pretty stupid.
__________________
Reply With Quote
Advertisement
  #11 (permalink)   [ ]
Old 07-06-2009, 09:49 AM
The Farmboy The Farmboy is a male United States The Farmboy is offline
...
Join Date: Jan 2008
Location: just leave me alone
View Posts: 425
Re: Java Programming - how to implement a Mouse Listener effectively?

Quote:
Originally Posted by 8bit View Post
You can also bang your head against a brick wall. I'm not sure why you'd do either, though, as they both make you look pretty stupid.
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
__________________

Reply With Quote
Reply

Tags
effectively, implement, java, listener, mouse, programming


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -5. The time now is 05:02 AM.

Contact Us - Zelda Universe - Archive - Privacy Statement - Top
no new posts