Hi!
I have an urgent problem! 

I made a form that has many textfields created with the method
PdfFormField.createTextField(PdfWriter writer, boolean multiline, boolean
password, int maxLen), and that because my textfields are in PdfPCell(table
cells).
My problem is that i want these textfields to have a Green background
color(in general, not only when focused), and all that i managed to do was
to set the backgroundcolor only when you focus that textfield(with
setMKBackgroundColor(Color)).

So please...if anyone knows how this can be done...it would be of a great
help!

Please notice that I'm not using the class Textfield, but PdfFormField, and
this is because with TextField i do not know how to insert the textfield in
a specific cell of a table.

Any solutions are good....!

Here is a part of the code:

PdfPTable nested2 = new PdfPTable(2);
cell = new PdfPCell();
            form = PdfFormField.createTextField(writer, false, false, 20);
            form.setFieldName("AbrufNr");
            form.setMKBackgroundColor(Color.LIGHT_GRAY);
            writer.addAnnotation(form);
            cell.setCellEvent(new TestMain(form, 1f, "textfieldAbrufNr"));
            cell.setBorder(PdfPCell.NO_BORDER);
            cell.setGrayFill(0.9f);
            nested2.addCell(cell);

-----------------------
public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] cb) {
if(formType.equalsIgnoreCase("textfieldAbrufNr")){
            form.setWidget(new Rectangle(rect.getLeft(padding),
rect.getBottom(padding),
                                rect.getLeft(padding) + 20, 
rect.getBottom(padding) + 10),
                                PdfAnnotation.HIGHLIGHT_INVERT);
        }
}
-----------------------
The class TestMain implements PdfPCellEvent; So this method cellLayout is
executed at the end...setting the position of my textfield in the cell!
-- 
View this message in context: 
http://www.nabble.com/PdfFormfield-textfield-background-color-tp16627283p16627283.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to