• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need Java help (easy question)

erub

Diamond Member
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);
}
 
Isn't is paintCommponnent? Anyway, yeah you don't create the combo box in the paint(componnet) method.
 
oh heh well that was the only thing i tried to getting anythign to display..should i put it all in init ()?
 
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
 
Back
Top