Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1730
| From | "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Using a method to cha |
| Message-ID | <465cc92d$0$4923$4c368faf@roadrunner.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <1180405766.323713.275130@q69g2000hsb.googlegroups.com> |
| Date | 2011-04-27 15:35 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui KDawg44 wrote: > Hi, > > I have a series of buttons name > > btnPXxY where X and Y are numbers ranging from 0 to 10 in a grid of > buttons. For example, a button name btnP0x0 and another named btnP0x1 > etc. Why not create a 10x10 array to hold the pointers to the buttons? The Object that btnArray[0][1] would point to would be the button at that grid location. > > When the buttons are pressed I want to pass integers x and y to a > method. This method is going to a bunch of things with these numbers > but one thing i would like to do would be to change the color of the > button corresponding to this. Each button can be its own listener and change its own color by waiting for the Action Event to be generated when a user clicks it. By doing it that way you don't need to know what the x and y values are. Each button changes itself and would implicitly know what to change. > > How can I pass the variables x and y into another variable name? is > this possible? something along the lines of: > > btnP + varX + x + varY. bgcolor = red. I personally don't understand what the above line is supposed to do. > > Thanks for any suggestions. I am HOPING that I do not have to pass > the button object into the function since I will have to change a > bunch of code for these buttons. > > Thanks. > hope that helps --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Find similar | Unroll thread
Using a method to change "KDawg44" <kdawg44@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000 Re: Using a method to cha "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
csiph-web