A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
set up buttons randomly
Joined: Feb 22, 2004
Mar 04, 2004 06:20:00
i havew tre buttons and every time i click on them i want them 2 switch sides.. aka 1 - 2 - 3. 3 - 1 - 2
public JButton AltKnapp1 = new JButton(); public JButton AltKnapp2 = new JButton(); public JButton AltKnapp3 = new JButton();
AltKnapp1.addActionListener(this); AltKnapp2.addActionListener(this); AltKnapp3.addActionListener(this);
how 2 do so?
Joined: May 15, 2001
Mar 04, 2004 07:16:00
If you dont need to physically move the buttons, just add a switch case to each of the listeners for the buttons and change the text on the button.
Hope this helps
I agree. Here's the link:
subject: set up buttons randomly
How to repaint/refresh/redraw JPanel
Can I distinguish JButtons?
Please need help with calculator program...
Troble working with JButtons..
Adding JButton Array to a applet issue
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013