Results 1 to 4 of 4
  1. #1
    Cortezz15 is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Default JLabel highlighting in crossword

    Hey guys, Im programming a crossword in Java, I have finished GUI and everything, my crossword consists of two-dimensional array[][] of JLabels- cells.
    Now i want to add a MouseListener that when i click on one cell in the crossword, it will change color. I know that JComponents haave setBackground(Color) method, but the problem is, that I dont know how to code which particular cell i clicked on.
    Sorry for my English, hope u understood me.. :)

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Moderator
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    9,917
    Rep Power
    16

    Default Re: JLabel highlighting in crossword

    Moved from New to Java.

    MouseEvent has a method that returns the source of the event.

    db
    Why do they call it rush hour when nothing moves? - Robin Williams

  3. #3
    Cortezz15 is offline Member
    Join Date
    May 2012
    Posts
    2
    Rep Power
    0

    Default Re: JLabel highlighting in crossword

    And what that is? Could u be more specific pls? :)

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Moderator
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    9,917
    Rep Power
    16

    Default Re: JLabel highlighting in crossword

    No, I don't believe in spoonfeeding. Read the API and find out for yourself, and/or go through the Oracle tutorials.

    Also, please spell words in full -- 'you' not 'u' -- this is a programming forum, not SMS chat.

    db
    Why do they call it rush hour when nothing moves? - Robin Williams

Similar Threads

  1. HIGHLIGHTING certain strings
    By onions in forum New To Java
    Replies: 3
    Last Post: 05-01-2012, 05:04 PM
  2. Crossword PUzzle Help Please
    By Sapana in forum New To Java
    Replies: 3
    Last Post: 11-16-2011, 09:24 PM
  3. Highlighting line in JTextArea
    By misiom1 in forum New To Java
    Replies: 4
    Last Post: 01-15-2011, 01:39 PM
  4. StringIndexOutOfBoundsException- Crossword Solver App.
    By numbskull20 in forum Advanced Java
    Replies: 3
    Last Post: 12-01-2010, 01:33 PM
  5. Adding a JLabel to a JPanel - jlabel not showing
    By Bongeh in forum New To Java
    Replies: 17
    Last Post: 04-06-2010, 11:02 PM

Tags for this Thread

Posting Permissions

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