BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 03-11-2010, 04:28 PM   #1 (permalink)
New Member
 
Join Date: Mar 2010
Model: 9000
PIN: N/A
Carrier: STUDENT
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Stupid java question, remove labelfield from MainScreen

Please Login to Remove!

Hello

I have a problem (again
I display labelfield, after click on this labelfield, I want to clear it, but I don't know how can I do that.

Please help me
Offline  
Old 03-11-2010, 06:04 PM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: N/A
PIN: N/A
Carrier: Fledge
Posts: 43
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Milia,

This class which extends MainScreen demonstrates how to do what you have asked. Are you familiar with FieldChangeListener? I would be happy to clarify if you have any questions.

Code:
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Keypad;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;

public class LabelRemovingMainscreen extends MainScreen implements FieldChangeListener {
	LabelField labelField;
	public LabelRemovingMainscreen() {
		labelField = new LabelField("Click on this field to remove it!", Field.FOCUSABLE) {
			protected boolean navigationClick(int status, int time) {
				fieldChangeNotify(0);
				return true;
			}			
			protected boolean keyChar(char character, int status, int time) {
				if (character == Keypad.KEY_ENTER) {
					fieldChangeNotify(0);
					return true;
				}
				return super.keyChar(character, status, time);
			}
		};
		
		labelField.setChangeListener(this);
		add(labelField);
	}
	public void fieldChanged(Field field, int context) {
		if (field == labelField) {
			delete(labelField);
		}
	}
}
Offline  
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

(1PCS) ST72F324K4T6 MCU 8BIT 16K FLASH 5V 32LQFP 72F324 ST72F324
$8.62
(1PCS) ST72F324K4T6 MCU 8BIT 16K FLASH 5V 32LQFP 72F324 ST72F324 picture(5PCS) STM8S003F3P6 IC MCU 8BIT 8KB FLASH 20TSSOP 8S003 STM8S003
$9.1
(5PCS) STM8S003F3P6 IC MCU 8BIT 8KB FLASH 20TSSOP 8S003 STM8S003 pictureInter-Tel Mitel 5000: 580.1000 / PM-1 2x LSM-4 With License Key and Flash
$139.99
Inter-Tel Mitel 5000: 580.1000 / PM-1 2x LSM-4 With License Key and Flash pictureFlash Furniture 14" Restaurant Bar Table X-Base 22" by Black Tables Signs Décor
$90.39
Flash Furniture 14(1PCS) STM32F051K4U6 IC MCU 32BIT 16KB FLASH 32UFQFN 32F051 STM32F051
$3.9
(1PCS) STM32F051K4U6 IC MCU 32BIT 16KB FLASH 32UFQFN 32F051 STM32F051 picture






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