Thursday, 8 August 2013

Anonymous class creation can not be evaluated. Java Design Eclipse

Anonymous class creation can not be evaluated. Java Design Eclipse

When I want to open the Design tab in Eclipse, I get this error: Anonymous
class creation can not be evaluated.
In general case it is impossible to evaluate creation of anonymous class.
So, expression new AbstractFormatterFactory() { @Override public
AbstractFormatter getFormatter(JFormattedTextField tf) { NumberFormat
format = DecimalFormat.getInstance(); format.setMinimumFractionDigits(2);
format.setMaximumFractionDigits(2);
format.setRoundingMode(RoundingMode.HALF_UP); InternationalFormatter
formatter = new InternationalFormatter(format);
formatter.setAllowsInvalid(false); formatter.setMinimum(0.0); return
formatter; } } was not evaluated.
The problem is in this block:
final JFormattedTextField textField1 = new JFormattedTextField(new
Float(10.01));
textField1.setFormatterFactory(new AbstractFormatterFactory() {
@Override
public AbstractFormatter getFormatter(JFormattedTextField tf) {
NumberFormat format = DecimalFormat.getInstance();
format.setMinimumFractionDigits(2);
format.setMaximumFractionDigits(2);
format.setRoundingMode(RoundingMode.HALF_UP);
InternationalFormatter formatter = new
InternationalFormatter(format);
formatter.setAllowsInvalid(false);
formatter.setMinimum(0.0);
return formatter;
}
});
How can I solve this anonymous class thing?

No comments:

Post a Comment