Jump to content

  • Log In with Google      Sign In   
  • Create Account

[java] Clicking on canvases... (canvii?)


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1   Members   

122
Like
Likes
Like

Posted 06 March 2000 - 03:11 PM

Hello again folks. Well I''m at it again with yet another problem. Basically what I have is a Panel with 4 canvases and 4 labels underneath each canvas (it''s to scroll through the tiles for a game editor). So what I want to do is when I click on a canvas, I want the label underneath it to go a different background color. Well it''s the clicking that''s the problem. Here''s what I tried: public boolean action (Event evt, Object arg) { String lbl = new String(); for (int x = 0; x < 4; x++) { if (evt.target == canvas[x]) lblObj[x].setBackground(Color.blue); else lblObj[x].setBackground(Color.lightGray); } return true; } Well needless to say this didn''t work. Does anyone have any other ideas/suggestions? I''d appreciate it. Thanks. Smoo BTW canvas[x] is another class that extends canvas

#2 Anonymous Poster_Anonymous Poster_*   Guests   

Likes

Posted 09 March 2000 - 12:04 PM

I believe this is using the old event model in Java...I highly recommend changing to using an ActionListener and updating the label in actionPerformed.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.