Hi
Let's take the following example....
I need two checkbox .. One for bold letters and one for italics...
I have written the following function
Code:
public boolean action(Event evt,Object arg){
if (evt.target instanceof Checkbox)
handleCheck((Checkbox)evt.target,evt);
if (evt.target instanceof Choice){
handleChoice((Choice)evt.target,evt);
}
return false;
}
The prolem is that it is executed 2 times.. One for mouse up event and one for mouse down event
What do u suggest me?
The following is the function called when a checkbox is clicked
Code:
void handleCheck(Checkbox c,Event evt){
if ( (c.getLabel()=="Bold") ){
TextFont = new Font(FontName,Font.BOLD+FontStyle,FontSize);
WriteText.setFont(TextFont);
}else if ( (c.getLabel()=="Italic") ){
TextFont = new Font(FontName,Font.ITALIC+FontStyle,FontSize);
WriteText.setFont(TextFont);
// ?You must add code for kseclick
}
}
The problem is that when i click theBold button i loose the italic attribute and vice-versa
What i must do?