Need Java help (easy question)

erub

Diamond Member
Jun 21, 2000
5,481
0
0
Ok I am trying to write a small applet, using a combobox..i cant get the darn thing to display!! Somebody please help me..here's what I have in the paint function (the welcome to java part works):

public void paint (Graphics g)
{

super.paint (g);


g.drawString("Welcome to Java Programming!", 25, 25);

String[] sex = {"Male","Female"};
JComboBox sexList = new JComboBox(sex);
sexList.setPopupVisible(true);
}
 

speg

Diamond Member
Apr 30, 2000
3,681
3
76
www.speg.com
Isn't is paintCommponnent? Anyway, yeah you don't create the combo box in the paint(componnet) method.
 

erub

Diamond Member
Jun 21, 2000
5,481
0
0
oh heh well that was the only thing i tried to getting anythign to display..should i put it all in init ()?
 

dighn

Lifer
Aug 12, 2001
22,820
4
81
Originally posted by: erub
oh heh well that was the only thing i tried to getting anythign to display..should i put it all in init ()?

yes put the component creation code in there