BlackBerryForums.com : Your Number One BlackBerry Community   Wallpaper Megaplex for BlackBerry   

»Sponsored Links




Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
bbCincinnati Offline
Knows Where the Search Button Is
 
Posts: 48
Join Date: Apr 2007
Model: 8700c
PIN: N/A
Carrier: Cingular
Default DateField - left align text - how to? - 05-06-2008, 11:00 AM

net.rim.device.api.ui.component.DateField

Hi Folks,

I'm trying to left align the text in a DateField. Thought it would be something simple like:

Code:
DateField df = new DateField( "", System.currentTimeMillis(), DateField.FIELD_LEFT);
or

Code:
DateField df = new DateField( "", System.currentTimeMillis(), net.rim.device.api.ui.DrawStyle.LEFT);
Either way compiles, but either way gives me an exception:

java.lang.IllegalArgumentException



Any ideas?

Thanks in advance
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
simon.hain Offline
CrackBerry Addict
 
Posts: 624
Join Date: Apr 2005
Location: hamburg, germany
Model: 8700
Carrier: o2
Default 05-07-2008, 02:20 AM

The same procedure as every year. Extend Field and implement your own draw-method.


java developer, Devinto, hamburg/germany
   
Reply With Quote
  (#3 (permalink)) Old
richard.puckett Offline
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Posts: 211
Join Date: Oct 2007
Location: Seattle, WA
Model: 8800
PIN: N/A
Carrier: AT&T
Default 05-07-2008, 10:37 AM

From the api docs:

Quote:
This builds a date field, inferring the required date format for this field from the style parameter you provide. Thus, at the very least, style must include one of DATE, TIME, or DATE_TIME.
Try adding (bitwise) one of the DateTime styles to your draw style. The following works for me.

Code:
DateField df = new DateField("", System.currentTimeMillis(), DateField.DATE_TIME | DrawStyle.LEFT);


Do your homework and know how to ask a good question.
   
Reply With Quote
  (#4 (permalink)) Old
bbCincinnati Offline
Knows Where the Search Button Is
 
Posts: 48
Join Date: Apr 2007
Model: 8700c
PIN: N/A
Carrier: Cingular
Smile Thanks! - 05-12-2008, 11:09 AM

Thanks guys.

Richard, your suggestion works perfectly!

Here is an interesting side note: I'm using the 4.1 API documentation (since I'm using the 4.1 JDE), which does not mention the required use of DATE, TIME, or DATE_TIME style bits (though it makes perfect sense after you pointed it out). I found this rather strange so I "google searched" part of the phrase and found that the 4.2 API documentation DOES indeed read just like you quoted. Looks like they've updated their documentation since 4.1

4.1 documentation:
RIM Device Java Library: Class DateField)

4.2 documentation:
RIM Device Java Library: Class DateField)

Anyway, thanks again for your help!
   
Reply With Quote
  (#5 (permalink)) Old
jfisher Offline
CrackBerry Addict
 
jfisher's Avatar
 
Posts: 706
Join Date: Jun 2005
Location: Manchester, UK
Model: 8310
Carrier: t-mobile
Default 05-12-2008, 04:44 PM

Quote:
Originally Posted by bbCincinnati View Post
I found this rather strange
The fun fun world of blackberry development!
   
Reply With Quote
  (#6 (permalink)) Old
bbCincinnati Offline
Knows Where the Search Button Is
 
Posts: 48
Join Date: Apr 2007
Model: 8700c
PIN: N/A
Carrier: Cingular
Default 05-13-2008, 07:33 AM

he he he
   
Reply With Quote
  (#7 (permalink)) Old
navneet.gupta Offline
Knows Where the Search Button Is
 
Posts: 19
Join Date: Mar 2008
Model: 8100
PIN: N/A
Carrier: Airtel
Default 05-19-2008, 08:28 AM

Quote:
Originally Posted by bbCincinnati View Post
he he he
dateField = new DateField("",System.currentTimeMillis(),DateField. TIME|DrawStyle.LEFT);
   
Reply With Quote
  (#8 (permalink)) Old
bbCincinnati Offline
Knows Where the Search Button Is
 
Posts: 48
Join Date: Apr 2007
Model: 8700c
PIN: N/A
Carrier: Cingular
Default 05-19-2008, 09:29 AM

Thanks navneet
   
Reply With Quote
Reply


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




Wallpaper Megaplex for BlackBerry


Copyright © 2004-2008 BlackBerryNews.com, BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.1