BlackBerry Forums Support Community               

Closed Thread
LinkBack Thread Tools
Old 08-26-2011, 07:18 AM   #1 (permalink)
New Member
Join Date: Aug 2011
Model: 8310
Carrier: Rogers
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Angry Showing an error

Please Login to Remove!

import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Font;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.container.MainScreen;

public class CustomButScreen extends MainScreen

public CustomButScreen()
public class CustomButtonField extends Field

private int backgroundColour = Color.GRAY;
private int highlightColour;
private int fieldWidth;
private int fieldHeight;
private String text;
private int padding = 8;

public CustomButtonField(String text, int highlightColour)
this.text = text;
this.highlightColour = highlightColour;
Font defaultFont = Font.getDefault();
fieldHeight = defaultFont.getHeight() + padding;
fieldWidth = defaultFont.getAdvance(text) + (padding * 2);
this.setPadding(2, 2, 2, 2);

protected boolean navigationClick(int status, int time)
return true;

protected void onFocus(int direction)
backgroundColour = highlightColour;

protected void onUnfocus()
backgroundColour = Color.GRAY;

public int getPreferredWidth()
return fieldWidth;

public int getPreferredHeight()
return fieldHeight;

protected void layout(int arg0, int arg1)
setExtent(getPreferredWidth(), getPreferredHeight());

protected void drawFocus(Graphics graphics, boolean on)


protected void fieldChangeNotify(int context)
this.getChangeListener().fieldChanged(this, context);
catch (Exception e)

protected void paint(Graphics graphics)
graphics.fillRoundRect(0, 0, fieldWidth, fieldHeight, 8, 8);
graphics.drawRoundRect(0, 0, fieldWidth, fieldHeight, 8, 8);
graphics.drawText(text, padding - 1, padding / 2 + 1);



The above code is showing an error that the classname CustomButtonField is an invalid modifier...I didnt understand what that actually means...and what i should do to rectify...
Thanks in advance
Old 08-26-2011, 07:30 AM   #2 (permalink)
BlackBerry Extraordinaire
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default Re: Showing an error

First, before you post any more code please read this sticky thread.

You are declaring a nested class CustomButtonField in the outer class constructor. Move the declaration outside of the constructor.
My other Blackberry is a PlayBook.
Old 08-29-2011, 05:20 AM   #3 (permalink)
Knows Where the Search Button Is
Join Date: Mar 2011
Model: 8900
Carrier: airtel
Posts: 29
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default Re: Showing an error

First seperate CustomButtonField class from mainscreen class.
dn call it in mainscreen.
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads for: Showing an error
Thread Thread Starter Forum Replies Last Post
Fresh Install 5.0 Remote SQL Error dvine RIM Software 0 10-12-2009 04:44 AM
Input system error - the system ..... starwatcher General 8100 Series Discussion - Pearl 7 01-30-2007 04:31 PM
CDO.DLL woes... kjohn BES Admin Corner 9 11-29-2005 10:17 AM
UPLink internal error keithc General BlackBerry Discussion 6 05-17-2005 03:24 PM
Device Error 507 (model 6280) PureShakti General BlackBerry Discussion 2 03-21-2005 03:09 PM

Used 1Pcs Ti505-6660 6851A 6108A 6208A 4532 4332 Siemens Plc Module M
Used 1Pcs Ti505-6660 6851A 6108A 6208A 4532 4332 Siemens Plc Module M pictureSiemens 6SN1118-0DH21-0AA1, Static sealed from Siemens
Siemens 6SN1118-0DH21-0AA1, Static sealed from Siemens picture1pcs New Siemens 3TF3110-1XB4 DC24V
1pcs New Siemens 3TF3110-1XB4 DC24V picture1PC USED SIEMENS 6FX1120-7BB01 Tested It In Good Condition
1PC USED SIEMENS 6FX1120-7BB01 Tested It In Good Condition picture1PC USED SIEMENS 6ES7721-2AB11-0EA2 Tested It In Good Condition
1PC USED SIEMENS 6ES7721-2AB11-0EA2 Tested It In Good Condition picture

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.