I am writing a code for a calculator. Everything works fine but instead of a square root symbol (√) I am getying a question mark (?). Does this mean I can't print Unicode characters on JButton
or am I wrong?
Here are two pieces containing the required character.
String operatorButtonText[] = {"/", "√", "*", "%", "-", "1/X", "+", "=" };
/***************/
if(opText.equals("√"))
{
try
{double tempd=Math.sqrt(temp);
cl.displayLabel.setText(MyCalculator.getFormattedText(tempd));}
catch(ArithmeticException excp)
{cl.displayLabel.setText("Divide by 0.");}
return;
}
Here is an image that could be helpful. I Have marked my problem in red circle.