× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Ok, the bg is like RPGLE prototype parameters, just documentation.  All this
you're saying fits the sample they gave:

style.setFillForegroundColor(HSSFColor.ORANGE.index);

HSSFColor.ORANGE.index is accessing the index field of the HSSFColor.ORANGE
class, and that field is a short integer, so they are passing a short
integer to the setFillForegroundColor.

I also found the pictorial diagram by Matthew Young at
http://jakarta.apache.org/poi/hssf/diagram1.html helpful in understanding
the relationships between all these things.  However, it did not have the
fill pattern constants; and it doesn't link to the items depicted, which
would be really handy.

Peter Dow
Dow Software Services, Inc.
909 793-9050 voice
909 793-4480 fax
951 522-3214 cell

----- Original Message ----- 
From: "Scott Klement" <rpg400-l@xxxxxxxxxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Monday, December 06, 2004 12:26 AM
Subject: Re: Using Java in RPGLE - setFillBackgroundColor


>
> On Sun, 5 Dec 2004, Peter Dow wrote:
> >
> > I wondered about that.  The method does say (short bg), and I wasn't
clear
> > on what "bg" meant.
>
> Okay... the following code is the Java equivalent of a prototype:
>
>  void setFillBackgroundColor(short bg)
>
> The word "void" means that this method doesn't return a value.
> The method name (like a subproc name in RPG) is "setFillBackgroundColor"
> It accepts one parameter.  The name of the parameter is "bg" and the data
> type is "short" (short integer)
>
> So, if that answers your question, the letters "bg" specify the name of
> the parameter.
>
> In RPG, this prototype would look be defined as follows:
>
> D HSSFCellStyle_setFillBackgroundColor...
> D                 PR                  ExtProc(*JAVA:
> D                                     'org.apache.poi.hssf.-
> D                                     usermodel.HSSFCellStyle':
> D                                     'setFillBackgroundColor')
> D    bg                          5I 0 value
>
> See? that's all "bg" is.  It's the name of the parameter.  It really
> doesn't matter at all -- it's just there for documentation purposes.
>
> > I did try creating an HSSFColor object, but couldn't
> > figure out how to assign it a specific color.  More reading made it look
> > like I have to create an HSSFColor.LIGHT_GREEN object, but in any case,
> > neither of those appear to be what setFillBackgroundColor is expecting
as a
> > parameter, unless maybe it's expecing two parameters, a short integer
and a
> > background color object.
>
> No, it's not expecting an HSSFColor object.  It's expecting an index into
> the color palette. It's just a number.  A short integer.  It's not an
> object.
>
> To find out what the number is for light green, you look in the Javadocs
> for the HSSFColor.LIGHT_GREEN class.  Here's the page I'm talking about:
>
>
http://jakarta.apache.org/poi/apidocs/org/apache/poi/hssf/util/HSSFColor.LIGHT_GREEN.html
>
> In this class, there's a named constant called "index" that contains the
> index in the color palette. Unfortunately, RPG can't read fields
> from a java class, it can only call methods, so you'll have to
> define your own named constant for this number in HSSF_H.
>
> So, under "Field summary" click on "index".  It takes you to a rather
> unhelpful description that says "public static final short index".  and
> then provides a link to "Constant Field Values."
>
> "public" means that the field is available to be read by other objects,
> it's not protected from view.  "static" means that this field is a part of
> the class, and is not different for each object that you create from the
> class.  There's just one copy.  "final" means that the value can't be
> changed, in other words, it's a constant.  "short", of course, is the data
> type.  And "index" is the name of the field.  As I said, not very helpful.
>
> click the "Constant Field Values" link and it tells you that the value of
> the index for light green is 42.
>
> So, after all of that long description of everything, what it boils down
> to is that this is what you need for light green in RPG:
>
>      D LIGHT_GREEN     C                   CONST(42)
>
> Then you pass that to the setFillForeground() and/or setFillBackground
> API.
>
> > If that's true, then what does the short integer
> > indicate?  And how do I create an appropriate background color object?
>
> Yeah, the number 42 gets passed to the method as a short integer.  Not an
> object.  Just a number.
>
> Set both the foreground and background of the "fill" to ensure that the
> background gets green.
>
>     HSSFCellStyle_setFillForegroundColor(ColHeading: LIGHT_GREEN);
>     HSSFCellStyle_setFillPattern(ColHeading: SOLID_FOREGROUND);
>
> Blam! It turns green.
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.802 / Virus Database: 545 - Release Date: 12/3/2004



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.