BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-19-2009, 01:02 AM   #1 (permalink)
New Member
 
Join Date: Oct 2009
Model: 9000
PIN: N/A
Carrier: aircel
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help!!! Adding Timer to my Custom Field.

Please Login to Remove!

I have created a custom field class "Seek" to draw a fillrectangle.

class Seek extends Field{

int fill;

protected void layout(int width, int height) {

setExtent(320,5);
}

protected void paint(Graphics graphics) {
graphics.setColor(Color.RED);
graphics.fillRect(0, 0, fill, 5);

}
protected void setValue(int value){
fill=value;
}

}

And I have created another class Test seek to set the fill value using a timer

public class TestSeek extends UiApplication{

public static void main(String[] args)
{
TestSeek gbResults = new TestSeek();
gbResults.enterEventDispatcher();

}

private TestSeek()
{
pushScreen(new ProgressScreen());
}

}

class ProgressScreen extends MainScreen{

Timer timer= new Timer();

int i=80;

Seek SeekField=new Seek();

public ProgressScreen()
{

add(SeekField);


timer.schedule(new RemindTask(),100,10);
// SeekField.setValue(i);
}
class RemindTask extends TimerTask
{
public void run()
{

if(i < 320)
{
i += 1;
SeekField.setValue(i);
}
else

timer.cancel();
}


}

But I am unable to animate filling the rectangle.

Last edited by rohit.roy : 11-19-2009 at 01:41 AM.
Offline  
Old 11-19-2009, 01:35 AM   #2 (permalink)
New Member
 
Join Date: Oct 2009
Model: 9000
PIN: N/A
Carrier: aircel
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found out the solution.
Use invalidate() while calling th setValue().
Guys u can use it as a custom gaugefield where u can change colors, shape, size.
And you can set the timer and use it as a progress bar wherever u want.

Thanks
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

Keysight Used 86100C Infiniium DCA-J Oscilloscope Mainframe (Agilent 86100C)
$14176.0
Keysight Used 86100C Infiniium DCA-J Oscilloscope Mainframe (Agilent 86100C) pictureKeysight Used 86100C Infiniium DCA-J Oscilloscope Mainframe(Agilent 86100C)
$10261.5
Keysight Used 86100C Infiniium DCA-J Oscilloscope Mainframe(Agilent 86100C) pictureHP 35650A SYSTEM MAINFRAME W/ EIGHT 35652A 50KHZ INPUT MODULES
$250.0
HP 35650A SYSTEM MAINFRAME W/ EIGHT 35652A 50KHZ INPUT MODULES  pictureHP Agilent 16500C Laboratory Touchscreen Logic Analysis System Mainframe Unit
$149.99
HP Agilent 16500C Laboratory Touchscreen Logic Analysis System Mainframe Unit pictureWavetek Network Analyzer Mainframe 1038-D14 Manual, Original
$25.0
Wavetek Network Analyzer Mainframe 1038-D14 Manual, Original picture






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