Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1730
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!novia!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail |
|---|---|
| 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) |
| X-Comment-To | comp.lang.java.gui |
| Newsgroups | comp.lang.java.gui |
| In-Reply-To | <1180405766.323713.275130@q69g2000hsb.googlegroups.com> |
| References | <1180405766.323713.275130@q69g2000hsb.googlegroups.com> |
| Content-Type | text/plain; charset=IBM437 |
| Content-Transfer-Encoding | 8bit |
| X-Gateway | time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] |
| Lines | 46 |
| Date | Wed, 27 Apr 2011 15:35:00 GMT |
| NNTP-Posting-Host | 96.60.20.240 |
| X-Complaints-To | news@tds.net |
| X-Trace | newsreading01.news.tds.net 1303918500 96.60.20.240 (Wed, 27 Apr 2011 10:35:00 CDT) |
| NNTP-Posting-Date | Wed, 27 Apr 2011 10:35:00 CDT |
| Organization | TDS.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.gui:1730 |
Show key headers only | View raw
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