BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 05-06-2008, 11:00 AM   #1
bbCincinnati
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Default DateField - left align text - how to?

Please Login to Remove!

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
Offline  
Old 05-07-2008, 02:20 AM   #2
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

The same procedure as every year. Extend Field and implement your own draw-method.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 05-07-2008, 10:37 AM   #3
richard.puckett
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
Default

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.
Offline  
Old 05-12-2008, 11:09 AM   #4
bbCincinnati
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Smile Thanks!

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!
Offline  
Old 05-12-2008, 04:44 PM   #5
jfisher
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Default

Quote:
Originally Posted by bbCincinnati View Post
I found this rather strange
The fun fun world of blackberry development!
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 05-13-2008, 07:33 AM   #6
bbCincinnati
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Default

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

Quote:
Originally Posted by bbCincinnati View Post
he he he
dateField = new DateField("",System.currentTimeMillis(),DateField. TIME|DrawStyle.LEFT);
Offline  
Old 05-19-2008, 09:29 AM   #8
bbCincinnati
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Default

Thanks navneet
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Genuine OEM IBM Selectric Tilt Pulley Bellcrank 1174427 Brand New Sealed Package picture

Genuine OEM IBM Selectric Tilt Pulley Bellcrank 1174427 Brand New Sealed Package

$29.95



IBM Wheelwriter 15 Series II Typewriter Lot of 3 Motors OEM Replacement picture

IBM Wheelwriter 15 Series II Typewriter Lot of 3 Motors OEM Replacement

$34.99



IBM Wheelwriter Universal Power Supply P/N 1434518 Series II Typewriter OEM picture

IBM Wheelwriter Universal Power Supply P/N 1434518 Series II Typewriter OEM

$59.99



DATALOGIC ADC GRYPHON GD4410 2D IMAGER IBM46XX/OEM USB/RS-232 MULTI-INTERFACE picture

DATALOGIC ADC GRYPHON GD4410 2D IMAGER IBM46XX/OEM USB/RS-232 MULTI-INTERFACE

$187.99



GENUINE IBM 28P2009 BLACK TONER CARTRIDGE FOR INFOPRINT 1130 1140 OEM picture

GENUINE IBM 28P2009 BLACK TONER CARTRIDGE FOR INFOPRINT 1130 1140 OEM

$54.99



New Set of 2 OEM I143 IBM Keys for Server Tower IBM-4367(A) - 9234-DNU picture

New Set of 2 OEM I143 IBM Keys for Server Tower IBM-4367(A) - 9234-DNU

$9.99







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