Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

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

4: Adsense

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 Smoo   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.