• Post Reply Bookmark Topic Watch Topic
  • New Topic

One central controller and 4 compas buttons  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have four point-of-the-compass buttons and a central controller button,
you have four colors that cycle round the compass buttons one step for each press of the controller.


I'd like to use an array for both colors and button, this is what I have so far.






poor result to say the least, no error when compiling, but I get this when running the program.









anyone have a solution as to why?

Thanks in advance

MrWolf
 
author & internet detective
Marshal
Posts: 37518
554
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This creates an array of four nulls that can hold JButtons. You actually have to attach the buttons to the array.


For example,
compassBtns[0] = south;
 
Bill Wolf
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thank you for your reply,

I'm still getting an error, that I don't understand.
When things compile and don't run...I'm really lost










I want to.....But I'm sorry I just don't get it....I've been going at it for awhile now............I'm going to step away from it for a few hours....

Wolf
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Crossposted here: one-controller-multiple-buttons-colors

To the OP, please read the FAQ regarding cross-posting: BeForthrightWhenCrossPostingToOtherSites
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37518
554
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check your private messages before replying.

Order matters. At the time you are creating the array of labels, the initialize() method hasn't run. So you've created an array of nulls. Try setting the compassBtns values after you have initialized the objects.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!