PDA

View Full Version : Need help with disabling buttons


Rudurk
11-16-2005, 12:12 AM
setLayout(new BorderLayout());
setLayout(new BorderLayout());
tenP = new JButton("10p");
twentyP = new JButton("20p");
fiftyP = new JButton("50p");
onePound = new JButton("£1");
twoPounds = new JButton("£2");
less1 = new JButton("Up to 1 hr");
oneTwo = new JButton("1 to 2 hr");
twoThree = new JButton("2 to 3 hr");
threeFour = new JButton("3 to 4 hr");
overFour = new JButton("Over 4 hr");

JPanel leftSide = new JPanel();
leftSide.setLayout(new GridLayout(5,1));


leftSide.add(tenP);
tenP.setEnable(false);

leftSide.add(twentyP);
twentyP.setEnable(false);

leftSide.add(fiftyP);
fiftyP.setEnable(false);

leftSide.add(onePound);
onePound.setEnable(false);

leftSide.add(twoPounds);
twoPounds.setEnable(false);
err how the heck do i disable thse buttons i tried almost everything lol pleaseeeee help

Pyth007
11-16-2005, 01:13 AM
javascript != java...
You're in the wrong forum

This site (http://ww2.cs.fsu.edu/~steele/XHTML/Sample2.java)has a toggle button... hope it helps

Rudurk
11-16-2005, 01:31 AM
Oh sorry discard then thought this was java programming

sonicdoomx
11-16-2005, 02:16 AM
Try past tense.

button.setEnabled(false);

http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JButton.html

Rudurk
11-16-2005, 03:12 AM
yah it works i cudn't think of what to do so i i thought mmm in html u use checked lol so i used enabled and it work :P thnx for ur help though