jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "buttons" Watch "buttons" New topic
Author

buttons

jake bellhorn
Greenhorn

Joined: May 03, 2006
Posts: 24


how do i add as many buttons as i want, whats a simple way of adding extra buttons?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by jake bellhorn:
...how do i add as many buttons as i want, whats a simple way of adding extra buttons?

Something like this...?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
jake bellhorn
Greenhorn

Joined: May 03, 2006
Posts: 24
where would i put that in the code though
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Try thinking it through...

One way to do this is to have a class with an instance variable called "buttons" (which references an array of JButtons) and an instance method called "makeButtons" (which takes an int value, instantiates the array to that size, and fills it with new JButton references).

So where would you put an instance variable and an instance method?
 
jQuery in Action, 2nd edition
 
subject: buttons
 
Similar Threads
Buttons and action events
HFJ TwoButtons problems
Beginners question (Head First - TwoButtons)
Getting the TwoButtons to add the gradient circle to the panel
addActionListener problem