Error: preverifier failed
Please Login to Remove!
Hello,
I am getting a following error while building my project:
"Error preverifying class com.maq.rim.ui.component.CustomButtonField
java/lang/NoClassDefFoundError: net/rim/device/api/ui/component/ButtonField
Error!: Error: preverifier failed"
I have the following code:
package com.maq.rim.ui.component;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.Graphics;
public class CustomButtonField extends ButtonField
{
private boolean oldVersion;
private int fieldWidth;
private int fieldHeight;
public CustomButtonField(boolean oldVersion)
{
super();
this.oldVersion = oldVersion;
}
public CustomButtonField(long style, boolean oldVersion)
{
super(style);
this.oldVersion = oldVersion;
}
public CustomButtonField(String label, boolean oldVersion)
{
super(label,ButtonField.HCENTER);
this.oldVersion = oldVersion;
}
public CustomButtonField(String label, long style, boolean oldVersion)
{
super(label, style);
this.oldVersion = oldVersion;
}
public void setFieldWidth(int width)
{
this.fieldWidth = width;
}
public void setFieldHeight(int height)
{
this.fieldHeight = height;
}
protected void onFocus(int direction)
{
this.getManager().invalidate();
super.onFocus(direction);
}
protected void onUnfocus()
{
this.getManager().invalidate();
super.onUnfocus();
}
protected void layout(int width, int height)
{
if (!oldVersion)
{
if ((this.fieldWidth != 0) && (this.fieldHeight != 0))
{
super.layout(this.fieldWidth, this.fieldHeight);
this.setExtent(this.fieldWidth, this.fieldHeight);
}
else if (this.fieldWidth != 0)
{
super.layout(this.fieldWidth, height);
this.setExtent(this.fieldWidth, height);
}
else if (this.fieldHeight != 0)
{
super.layout(width, this.fieldHeight);
this.setExtent(width, this.fieldHeight);
}
else
{
super.layout(width, height);
}
}
else
{
super.layout(width, height);
}
}
protected void paint(Graphics graphics)
{
if (oldVersion)
{
int currentColor = graphics.getColor();
graphics.setColor(Style.BACKGROUND2);
graphics.fillRect(0, 0, getWidth(), getHeight());
graphics.setColor(currentColor);
}
super.paint(graphics);
}
}
Can anybody help me in resolving this error ??
|