Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Answer to GamiDrac

Status
Not open for further replies.

prosper

Programmer
Sep 4, 2001
631
HK
import java.awt.*;
import javax.swing.*;
import java.awt.event.*; //***
public class JCombo extends JApplet
implements ActionListener {
JComboBox myCombo;
JPanel mypan;
JTextArea myBox;
JButton myRound;
String myOrder=" " ;



public void init() {
mypan = new JPanel();
myBox = new JTextArea (5,15);
myCombo = new JComboBox();
myCombo.addItem ("Larger");
myCombo.addItem ("Beer");
myCombo.addItem ("Red Wine");
myCombo.addItem ("White Wine");
myCombo.addItem ("Orange juce");
myCombo.addItem ("lemonade");
mypan.add(myCombo);
myRound = new JButton ("My order>>>>");
myRound.addActionListener (this);
mypan.add(myRound);
mypan.add (myBox);
setContentPane(mypan);
}
public void actionPerformed (ActionEvent e) { //***
myOrder += myCombo.getSelectedItem()+"\n";
myBox.setText(myOrder);
}
}
//You have typing errors in ***
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top