Results 1 to 6 of 6
  1. #1
    stringargs is offline Member
    Join Date
    Nov 2010
    Posts
    9
    Rep Power
    0

    Default method to check which type of object with which name is located at given coordinates

    is there one?
    I have 100 rectangles on a canvas and need to know exactly which one is located at the specified coordinates
    right now I'm using contains(int x, int y) from the Rectangle class, but that doesn't really work because i need to call it on the rectangle I think is there..

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

  3. #3
    stringargs is offline Member
    Join Date
    Nov 2010
    Posts
    9
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    How about having your rectangles in an ArrayList and iterating through the list.
    that was my first idea but it can be quite slow with many of 'em and that I do not like

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by stringargs View Post
    that was my first idea but it can be quite slow with many of 'em and that I do not like
    Could you translate this line into English? Thanks!

  5. #5
    stringargs is offline Member
    Join Date
    Nov 2010
    Posts
    9
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    Could you translate this line into English? Thanks!
    That was my first idea, but it (the program/the execution of the program) can be quite slow with many of 'em (Rectangles in an array that i have to iterate through) and that I do not like.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Input type Check box
    By jeeva in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 02-17-2009, 03:36 PM
  2. Input type Check box
    By jeeva in forum Advanced Java
    Replies: 1
    Last Post: 02-05-2009, 05:04 PM
  3. using instanceof to get Object type and parent type?
    By xcallmejudasx in forum New To Java
    Replies: 2
    Last Post: 11-06-2008, 07:24 PM
  4. Object locations via grid coordinates HELP.
    By deadman_uk in forum New To Java
    Replies: 4
    Last Post: 11-18-2007, 09:32 PM
  5. Creating object of Type Object class
    By venkatv in forum New To Java
    Replies: 3
    Last Post: 07-17-2007, 04:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •