Custome Field took a nullpointexception in the labefiled and 7.1 paint method only you have this problem! Pls help me?
KIM I create a custom entry field as below:
public class AddEditField extends HorizontalFieldManager { private LabelField labelField; private EditField contentField; private RichTextField wrapaddField; HorizontalFieldManager textMgr; HorizontalFieldManager wrapMgr; private static final int HPADDING = Display.getWidth() <= 320 ? 6 : 8; Font font; public AddEditField(String label, Font font, int maxSpace) { this(label, 0, font, maxSpace); } public AddEditField(String label, long style, Font cfont, int maxSpace) { super(NO_HORIZONTAL_SCROLL); this.font = cfont; textMgr = new HorizontalFieldManager(HORIZONTAL_SCROLL | FIELD_VCENTER); wrapMgr = new HorizontalFieldManager(FIELD_VCENTER); wrapaddField = new RichTextField(RichTextField.TEXT_ALIGN_LEFT); long cstyle = 0; if (style == 0) { cstyle = EditField.NO_NEWLINE | EditField.FOCUSABLE | EditField.EDITABLE | FIELD_VCENTER; } else { cstyle = EditField.NO_NEWLINE | EditField.FOCUSABLE | EditField.EDITABLE | style | FIELD_VCENTER; } contentField = new EditField(cstyle) { protected void paint(Graphics graphics) { // Font font = getFont().derive(Font.PLAIN, fontSize); graphics.setFont(font); graphics.setColor(0x666666); super.paint(graphics); } protected void onFocus(int direction) { super.onFocus(direction); invalidate(); } protected void onUnfocus() { super.onUnfocus(); // if (VirtualKeyboard.isSupported()) { // VirtualKeyboard vKeyboard =getVirtualKeyboard(); // vKeyboard.setVisibility(VirtualKeyboard.HIDE); // } } }; labelField = new LabelField(label, FIELD_LEFT | FIELD_VCENTER) { protected void paint(Graphics graphics) { graphics.setColor(0x006699); graphics.setFont(font); super.paint(graphics); } }; LabelField spaceF = new LabelField() { protected void layout(int width, int height) { // TODO Auto-generated method stub //super.layout(HPADDING, font.getHeight() + 10); setExtent(HPADDING, font.getHeight() + 10); } }; add(spaceF); add(labelField); final int space = maxSpace - font.getAdvance(labelField.getText()); LabelField spaceF2 = new LabelField() { protected void layout(int width, int height) { // TODO Auto-generated method stub // super.layout(space, font.getHeight() + 10); setExtent(space, font.getHeight() + 10); } }; add(spaceF2); textMgr.add(contentField); wrapMgr.add(wrapaddField); add(textMgr); } public String getText() { return contentField.getText(); } public void setText(String text) { synchronized (UiApplication.getEventLock()) { wrapaddField.setText(text); contentField.setText(text); } } public void setEditMode(boolean editable) { String text = wrapaddField.getText(); synchronized (UiApplication.getEventLock()) { if (editable) { contentField.setText(text); if (wrapMgr.getManager() == this) { delete(wrapMgr); } if (textMgr.getManager() != this) { add(textMgr); } } else { if (textMgr.getManager() == this) { delete(textMgr); } if (wrapMgr.getManager() != this) { add(wrapMgr); } } } } }
Then I create: new AddEditField ("address:", cFont, maxSpace); and add it to a screen.
When I try to open this form. It is nullpointexception: the eclipse debugger show the info such as:
AddEditField$ 4labelfield.paint line 385.
Please help me to check the code. why it can run in 0 s 7.0 and before, only 7.1 has had this problem?
Thank you
Hi Flybrid,
I checked at the time of your code,
I am able to run your code by deleting page layout override methods in two fields of the label.
The problem with the substitution of the method of layout in the spaceF and spaceF2 fields.
But I can't explain why.
I think that you can achieve the same thing by replacing getPrefferedWidth() and getPrefferedHeight() above the fields instead of page layout.
Thank you.
Tags: BlackBerry Developers
Similar Questions
-
Question
I can't see the pictures in my yahoo email, I did not have this problem with other browsers. I used the mode 5 firefox safe and always without success. Help, pleaseTo help other users find solutions, please come back to this Thread and connect you to the
Forum with your user name and password:Click on 'resolved' beside the answer above that BETTER resolved your issue
DO NOT CLICK on 'Solved It' next to this answer
-
When I copy a URL and go to paste it into an email, it will not stick. Another box opens. I can paste the URL in the subject line, but doesn't hyperlink it. (blue) When you use Internet Explorer, I don't have this problem. I'm new to FF with a new computer.
Paste a link in the subject line does not a link so that the part is normal. But being not not able to paste into the body of the e-mail is not. I can't think of a reason that would happen. What email program are you using?
-
The update has caused a problem with sending emails which I solved it with help, but now I can't send to several people without all of the addresses being shown as well as their address book names, even when I use the BCC field.
It's ahotmail/live/outlook.com/msn account? There were reports a few weeks that BCC was pleased supported if the account is accessible thanks to a 3rd - party such TB program, but it still worked if the account is accessible via webmail. I think that MS has been alerted to the issue, but I do not know if it has been resolved.
-
What are the security settings to lock a form with fields to fill and still allow someone drive to fill in the fields as as to save the form and print it?
You want to allow someone to open your document and fill in the form (the fields that you have created), but not change or edit the form, right? Here is the answer - assuming you use Acrobat Pro and someone will open the PDF with the Acrobat Reader 9 minimum and more:
Tools > Protection > encrypt< encrypt="" with="">
Select YES to change security.
Opens in a new window:
Do not select NOT open the Document (or will require a password to open the document.)
SELECT: Permissions (check the box next to ' Restrict editing and printing of the document. ")
Change the following 2 settings in the drop-down list box:
Printing allowed: select high resolution
Changes allowed: select commenting on, fill in the fields on the form and signature of signature fields
Selected leave: "enable access text for playback devices to screen for people with visual impairments.Change password Permissions (insert a password)
Leave all the other settings alone in 'Options '.
OK - OK
Again enter the Permissions password (the one you entered above)
OK - OK
Save the PDF file to apply security [notice that (SECURED0 will appear after the title of the document]
-
Hi, when you send an email using the mail my signature seems to drop before my email is considered by my beneficiaries. This does not happen all the time but often. Is anyone else know / encountered this problem? If so help to rectify this would be greatly appreciated please. Thank you
It is up to the recipient how their e-mail is displayed. For example, if you include html or an image in your email the recipient may set up their customer e-mail to not display html or images. You have no control over the way a recipient chooses configure their e-mail client.
-
My iPhone 6 installed 10.0.2 stops when it gets to 40% of autonomy. In addition, it seems to pass power WAY to fast with the new software. Does anyone else have this problem?
Hello brooksm549,
Thank you for using communities of Apple Support.I got your message which, since updating your iPhone 6 to iOS 10.0.2 your iPhone stops when it is 40% and the power to empty very quickly. I understand your concern with the iPhone turn off and drains the battery. I recommend you to review the use of the battery to see what app contributes more to the battery drain. The following article will provide you with steps on how to check the use of the battery:
On the use of the battery on your iPhone, iPad and iPod touch
When you know about the soft uses more battery, you can change your settings in order to optimize the battery life:
Maximize the life of the battery and battery life
Best regards.
-
My 5s iphone suddenly showed no service, then I made an attempt to update to ios and itunes connected, now iphone is not enable and display cannot connect to the server and in itunes it shows unable to check your device.please help me
Assuming that you have a valid SIM card in the phone, it is more often symptomatic of a phone that has been hacked or jailbroken to unlock.
Where do you have the phone first?
-
My iPhone 6 load very slowly. And sometimes other cables works instantly on my iPhone unlike my sister who has the same phone as me. My sister does not have this problem with our cable. Also the battery becomes low too quickly.
In the last months, I use as a class a lightning because here in the Philippines, original iPhone cable cables look like $25. My sister also uses the same cable as me but she has no problems
How to fix this please? Can I go to any apple centre and check my phone to see what happened?
Hello
Follow the steps here, including the verification of the charge for debris socket:
If your iPhone, iPad or iPod touch won't charge - Apple Support
-
I get this message when I turn my macbook pro on "there is no set of application to open the document"stream_000b.strings ". "How can I get rid of him. pls help
Check preferences system/users and groups to see if this item is in your login items. If so, select it and use the sign less to remove.
If she is not there, see if you can find the file by using one of these programs. If you go Finder/display/show bar path, it will show you where it is located. You can then remove it.
-
My pro iPad connects to the WIFI, but loses connectivity to drops in use. My other IOS devices (iPhone, macbook, etc.) do not have this problem. Ideas to solve?
Hello BrooklynWM!
I definitely want my iPad to stay connected to the Wi - Fi connection while I use it. Thanks for posting that other iOS and OS X devices have no problem with the connectivity dropping. We can try a few things.
Would first go through the steps listed in this article: If your iPhone, iPad or iPod touch connects to a Wi-Fi - Apple Support Network
Then if it does not help, you can check network settings with this: recommended for the WiFi routers and access - points Apple supported
After trying those, if you still see the drop connectivity, make sure the iPad Pro is updated with iOS 9.3.2 and check to see if the connection when you are in a certain place, time, or one event happening elsewhere in the House.
Best regards.
-
All of a sudden my MacBook loses the wifi connection when he woke from sleep mode. Does anyone else have this problem?
Tell us what event preceded "all of a sudden" - something to do with the software or hardware environment
-
"When you try to upgrade to photos in app store I get this message"the object you requested is not available in the store US."does anyone else have this problem or can you tell me how to find pictures in the app store" someone else meets this. Is it me or is it pictures?
Ever photos first? It should have been included when you first update of Yosemite and now El Capitan. I know that iPhotos updates get a message like that, but I didn't know the Photos app with a message with it.
-
I tried the extension 0.4.3, which I found in a forum, but it did not work... I have foxtab on installed... and anti-ad adds...
This problem may be caused by an extension that is not working properly.
Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).
- Makes no changes on the start safe mode window.
- https://support.Mozilla.org/KB/safe+mode
-
The hard drive of my imac has disappeared, I have this G5 1.6, but can't do much with it, is anyway I can get a copy of OS x 10.5 from Apple?
Phone from the Apple Store online and ask.
(141583)
Maybe you are looking for
-
How can I restore a list of contacts in my address book?
Pretty much what it says above - I deleted a list from one of my address books of void and a second later realized that I had deleted that badly. I found a similar question to the year or there is but he suggested an add-on which seems to no longer e
-
I have a computer workstation which consists of a GC760AV/GC459AV w / a HP L1710 monitor. I teach the language and I need to be able to record my students. My other older computers have a microphone built into the monitor. I can't save, so I started
-
Removed PC Optimizer Pro but still pop up
I deleted a program, called PRO OPTIMIZER from PC, through the thing to uninstall under windows. now it shows the program he return once again, but it keeps popping up, and the icon is still on my desk. I've tried everything, and it won't remove it y
-
Remember - this is a public forum so never post private information such as numbers of mail or telephone! Ideas: If you have to do anything toBIOS You have problems with programs Error messages Recent changes to your computer What you have already tr
-
Triple the screen on Windows Vista problem
Moose title: Triple display problem I have a laptop Toshiba A505D and I connect a HP 2159 m 21 "LCD monitor on the left side and keep there for a second monitor, I have a hub of Toshiba DynaDock USB which has built in video card that I run a second 2