本文整理汇总了Java中com.lowagie.text.Chunk.setUnderline方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.setUnderline方法的具体用法?Java Chunk.setUnderline怎么用?Java Chunk.setUnderline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.Chunk
的用法示例。
在下文中一共展示了Chunk.setUnderline方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.lowagie.text.Chunk; //导入方法依赖的package包/类
/**
* Demonstrates some Chunk functionality.
*/
@Test
public void main() throws Exception {
// step 1: creation of a document-object
Document document = new Document();
// step 2:
// we create a writer that listens to the document
PdfWriter.getInstance(document, PdfTestBase.getOutputStream("Chunks.pdf"));
// step 3: we open the document
document.open();
// step 4:
Chunk fox = new Chunk("quick brown fox");
float superscript = 8.0f;
fox.setTextRise(superscript);
fox.setBackground(new Color(0xFF, 0xDE, 0xAD));
Chunk jumps = new Chunk(" jumps over ");
Chunk dog = new Chunk("the lazy dog");
float subscript = -8.0f;
dog.setTextRise(subscript);
dog.setUnderline(new Color(0xFF, 0x00, 0x00), 3.0f, 0.0f, -5.0f + subscript, 0.0f,
PdfContentByte.LINE_CAP_ROUND);
document.add(fox);
document.add(jumps);
document.add(dog);
// step 5: we close the document
document.close();
}
示例2: main
import com.lowagie.text.Chunk; //导入方法依赖的package包/类
/**
* Demonstrates some Chunk functionality.
*
* @param args
* no arguments needed here
*/
public static void main(String[] args) {
System.out.println("the Chunk object");
// step 1: creation of a document-object
Document document = new Document();
try {
// step 2:
// we create a writer that listens to the document
PdfWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + "droidtext" + java.io.File.separator + "Chunks.pdf"));
// step 3: we open the document
document.open();
// step 4:
Chunk fox = new Chunk("quick brown fox");
float superscript = 8.0f;
fox.setTextRise(superscript);
fox.setBackground(new Color(0xFF, 0xDE, 0xAD));
Chunk jumps = new Chunk(" jumps over ");
Chunk dog = new Chunk("the lazy dog");
float subscript = -8.0f;
dog.setTextRise(subscript);
dog.setUnderline(new Color(0xFF, 0x00, 0x00), 3.0f, 0.0f, -5.0f + subscript, 0.0f,
PdfContentByte.LINE_CAP_ROUND);
document.add(fox);
document.add(jumps);
document.add(dog);
} catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
// step 5: we close the document
document.close();
}
示例3: getChunk
import com.lowagie.text.Chunk; //导入方法依赖的package包/类
/**
*
*/
protected Chunk getChunk(Map<Attribute,Object> attributes, String text, Locale locale)
{
// underline and strikethrough are set on the chunk below
Font font = getFont(attributes, locale, false);
Chunk chunk = new Chunk(text, font);
if (hasUnderline(attributes))
{
// using the same values as sun.font.Fond2D
chunk.setUnderline(null, 0, 1f / 18, 0, -1f / 12, 0);
}
if (hasStrikethrough(attributes))
{
// using the same thickness as sun.font.Fond2D.
// the position is calculated in Fond2D based on the ascent, defaulting
// to iText default position which depends on the font size
chunk.setUnderline(null, 0, 1f / 18, 0, 1f / 3, 0);
}
Color backcolor = (Color)attributes.get(TextAttribute.BACKGROUND);
if (backcolor != null)
{
chunk.setBackground(backcolor);
}
Object script = attributes.get(TextAttribute.SUPERSCRIPT);
if (script != null)
{
if (TextAttribute.SUPERSCRIPT_SUPER.equals(script))
{
chunk.setTextRise(font.getCalculatedLeading(1f)/2);
}
else if (TextAttribute.SUPERSCRIPT_SUB.equals(script))
{
chunk.setTextRise(-font.getCalculatedLeading(1f)/2);
}
}
if (splitCharacter != null)
{
//TODO use line break offsets if available?
chunk.setSplitCharacter(splitCharacter);
}
return chunk;
}
示例4: textLinedCell
import com.lowagie.text.Chunk; //导入方法依赖的package包/类
/**
* Creates a Text underlined cell.
* @param phrase the text to use
* @param font the font to use
* @return the formatted table cell
* @throws BadElementException if the cell cannot be generated
* @since 1.1
*/
public static Cell textLinedCell(String phrase, Font font) throws BadElementException {
Chunk ch = new Chunk(phrase, font);
ch.setUnderline(1f, -2f);
Cell cell = new Cell(new Phrase(ch));
return cell;
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:15,代码来源:ReportHelper.java
示例5: textLinedMoneyCell
import com.lowagie.text.Chunk; //导入方法依赖的package包/类
/**
* Creates a Text Money underlined cell.
* @param phrase the text to use
* @param font the font to use
* @return the formatted table cell
* @throws BadElementException if the cell cannot be generated
* @since 1.1
*/
public static Cell textLinedMoneyCell(String phrase, Font font) throws BadElementException {
Chunk ch = new Chunk(phrase, font);
ch.setUnderline(1f, -2f);
Cell rightCell = new Cell(new Phrase(ch));
rightCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
return rightCell;
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:16,代码来源:ReportHelper.java