Hey everyone im new and in need of help

Associate
Joined
11 Mar 2007
Posts
4
Hey everyone, im new to OCUK forums been told by Darkshadow to sign up for the past months lol but i need some help in programming :(

RIght...

public void actionPerformed(ActionEvent e)

if (e.getSource() == tea)

tea.setVisible(false);
coffee.setVisible(false);
choco.setVisible(false);
milk.setVisible(true);
nomilk.setVisible(true);
one.setText("Tea");



if(e.getSource() == coffee);

tea.setVisible(false);
choco.setVisible(false);
milk.setVisible(true);
nomilk.setVisible(true);
one.setText("Coffee");


Right, when i press the Cofee button i want the text label to put "Tea" and when i press "coffee" i want it to put coffee.. That happens, but when i press tea, it still shows coffee, looks like my program goes straight down to the settext Coffee code to any button press.

Can someone help me how to change that please


**oh also and when that menu opens a Milk or no milk should appear, and i want it to continue the line to say " Coffe, No sugar , " so like it gets recorded for the user, im pretty stuck i might do it as another jtextbox to sho Sugar in another text box but i'll have to largen the size which criteria says cant be too big **


Can anyone help me pweeez :(
 
Unless you omitted them for speed, you're missing some brackets and have a spurious ; character after the second "if" :
Code:
if (e.getSource() == tea)

{
tea.setVisible(false);
coffee.setVisible(false);
choco.setVisible(false);
milk.setVisible(true);
nomilk.setVisible(true);
one.setText("Tea");
}


if(e.getSource() == coffee)   ///    ;
{
tea.setVisible(false);
choco.setVisible(false);
milk.setVisible(true);
nomilk.setVisible(true);
one.setText("Coffee"); 
}
 
Back
Top Bottom