Code example for Choice

Methods: addItem

0
			c.addItem("200");
			c.addItem("400");
		cs[numChoices++] = c;
 
		add(new Label("Option 2"));
		add(c = new Choice());
			c.addItem("0");
			c.addItem("100");
			c.addItem("200");
			c.addItem("400");
		cs[numChoices++] = c;
 
		Panel p = new Panel();
		p.setBackground(Color.pink);
		p.add(new Label("Total:"));
		p.add(resultField = new Label("000000"));
		add(p);
 
		sendButton = new Button("Send it");
		add(sendButton);						// connect Button into Applet
Experience pair programming with AI  Get Codota for Java