Peter is absolutely correct.
Logically, the right thing is:
csf.setNegativeNumbersStyle(CSpFormatter.NEGATIVE_WITH_MINUS
|CSppFormatter.NEGATIVE_IN_COLOR
|CSpFormatter.NEGATIVE_WITH_PARENS);
As a matter of fact, PAREN, COLOR, MINUS are 1,2,4 respectively, and since
each of them represent a single bit, simple addtition would give the same
result, thanks to the careful way of planning out these integer values by
ND.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 15, 1999 2:08 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [ND] Negative Numbers in Color and in Parenthesis
>
>
>
> you need to use bitwise or function for java.
>
> Or I think if you just add them up it will work.
> (if the value are 1 , 2 , 4 then adding them will work)
>
>
>
> "Samuel Antoun" <[EMAIL PROTECTED]> wrote:
> >
> >Hi Everybody,
> >I'm trying to Display Negative Numbers with ALL the following:
> >1) In RED
> >2) In Parenthesis
> >3) With a Minus Sign.
> >
> >I'm using the CSpFormatter class, and it works for ONLY ONE
> of the above at a time.
> >
> >Question: the method setNegativeNumbersStyle(int) accepts an
> int. How do I "OR" the NEGATIVE_IN_COLOR,
> >NEGATIVE_WITH_PARENS, and NEGATIVE_WITH_MINUS ??
> >
> >Below is the Code I tried:
> >
> >
> >private String formatForDisplay(String s) {
> >
> > String formattedString = "";
> >
> > CSpFormatter csf = new CSpFormatter();
> >
> > csf.setType(CSpFormatter.NUMBER_TYPE);
> > csf.setUse1000Separator(true);
> >
> > //int style =
> NEGATIVE_IN_COLOR.or(NEGATIVE_WITH_MINUS).or(NEGATIVE_WITH_PARENS);
> > //int style =
> CSpFormatter.NEGATIVE_IN_COLOR.or(CSpFormatter.NEGATIVE_WITH_M
> INUS).or(CSpFormatter.NEGATIVE_WITH_PARENS);
> > //csf.setNegativeNumbersStyle(style);
> >
> >
> > //csf.setNegativeNumbersStyle(CSpFormatter.NEGATIVE_WITH_MINUS);
> > csf.setNegativeNumbersStyle(CSpFormatter.NEGATIVE_IN_COLOR);
> >
> //csf.setNegativeNumbersStyle(CSpFormatter.NEGATIVE_WITH_PARENS);
> >
> > try {
> > formattedString = csf.format( (CSpString) new
> CSpString(s),false);
> > CSpLog.send (this,CSpLog.ERROR,"Formatted
> STRING ==> " + formattedString );
> >
> > } catch(CSpFormatException e) {
> >
> >
> > CSpLog.send (this,CSpLog.ERROR,"Format Error " + e );
> > }
> >
> >
> > return(formattedString);
> >
> > }
>
> ______________________________________________________________
> ___________
>
> For help in using, subscribing, and unsubscribing to the discussion
> forums, please go to:
> http://www.netdynamics.com/support/visitdevfor.> html
>
> For dire
> need help, email: [EMAIL PROTECTED]
>
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]