本文整理了Java中javax.swing.JTable.print()
方法的一些代码示例,展示了JTable.print()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.print()
方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:print
暂无
代码示例来源:origin: stackoverflow.com
DefaultTableModel dtm = new DefaultTableModel(new String[] { "Column 1" }, 1);
JTable jTable2 = new JTable(dtm) {
@Override
public Printable getPrintable(PrintMode printMode, MessageFormat headerFormat, MessageFormat footerFormat) {
return new TablePrintable(this, printMode, headerFormat, footerFormat);
}
};
try{
jTable2.print(JTable.PrintMode.NORMAL, header, null);
}
catch(java.awt.print.PrinterException e){
System.out.println("error");
}
代码示例来源:origin: net.sf.squirrel-sql.plugins/smarttools
private void printResult()
{
try
{
MessageFormat headerFormat = new MessageFormat(lblTitleTable.getText());
MessageFormat footerFormat = new MessageFormat(i18n.GLOBAL_ALIAS + ": "
+ session.getAlias().getName() + " | "
+ DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(new Date())
+ " | " + i18n.GLOBAL_PAGE + " {0} ");
tblResult.print(PrintMode.FIT_WIDTH, headerFormat, footerFormat);
} catch (PrinterException e)
{
log.error(e.getLocalizedMessage());
}
}
代码示例来源:origin: org.vesalainen.dsql/dsql
@Override
public void actionPerformed(ActionEvent e)
{
try
{
MessageFormat header = new MessageFormat(title+" "+options+" {0,NUMBER,INTEGER}");
boolean visible = frame.isVisible();
frame.setVisible(true);
table.print(JTable.PrintMode.FIT_WIDTH, header, null);
frame.setVisible(visible);
}
catch (PrinterException ex)
{
JOptionPane.showMessageDialog(null, ex.getLocalizedMessage(), I18n.get("ERROR"), JOptionPane.ERROR_MESSAGE);
}
}
代码示例来源:origin: net.sf.squirrel-sql.plugins/smarttools
/**
* Print the content of the given table
*
* @param table
* tables content to print
* @param headerText
* header text for output page
* @param footerText
* footer text for output page
*/
public static void printTable(JTable table, String headerText, String footerText)
{
try
{
MessageFormat headerFormat = new MessageFormat(headerText);
MessageFormat footerFormat = new MessageFormat(footerText);
table.print(PrintMode.FIT_WIDTH, headerFormat, footerFormat);
}
catch (PrinterException e)
{
log.error(e.getLocalizedMessage());
}
}
代码示例来源:origin: stackoverflow.com
JTable toPrint = new JTable(printModel);
toPrint.setSize(toPrint.getPreferredSize());
JTableHeader tableHeader = toPrint.getTableHeader();
tableHeader.setSize(tableHeader.getPreferredSize());
toPrint.print(JTable.PrintMode.FIT_WIDTH);
代码示例来源:origin: stackoverflow.com
JTableHeader tableHeader = jTable2.getTableHeader();
tableHeader.setSize(tableHeader.getPreferredSize());
jTable2.print(JTable.PrintMode.FIT_WIDTH);
} catch (PrinterException ex) {
ex.printStackTrace();
代码示例来源:origin: stackoverflow.com
JTable printTable = new JTable(table.getModel());
printTable.setSize(printTable.getPreferredSize());
JTableHeader tableHeader = printTable.getTableHeader();
tableHeader.setSize(tableHeader.getPreferredSize());
printTable.setShowHorizontalLines(false);
printTable.setShowVerticalLines(false);
printTable.print(JTable.PrintMode.FIT_WIDTH);
代码示例来源:origin: stackoverflow.com
jTableData.print();
}catch(Exception ee){}
代码示例来源:origin: stackoverflow.com
g2.clipRect(0, 0, 500, 500);
table.print(g2);
g2.setClip(oldClip);
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-common
/**
* Methode qui ajoute le tableau jtable dans le fichier pdf
* @param jtable
* @author Adrien Hadoux
*/
public static void addJTableToPdf(JTable _tableToadd,PdfWriter _writer){
PdfContentByte cb = _writer.getDirectContent();
cb.saveState();
Graphics2D g2 = cb.createGraphicsShapes(500, 500);
cb.createGraphics(500, 500);
Shape oldClip = g2.getClip();
g2.clipRect(0, 0, 500, 500);
_tableToadd.print(g2);
g2.setClip(oldClip);
g2.dispose();
cb.restoreState();
}
代码示例来源:origin: stackoverflow.com
MessageFormat header = new MessageFormat("Customer: " + customer.getText() + " | Date: " + new SimpleDateFormat("dd/MM/yyyy").format(date.getValue()));
try {
table.print(JTable.PrintMode.FIT_WIDTH, header, null, true, null, true);
} catch (PrinterException ex) {
ex.printStackTrace();
代码示例来源:origin: stackoverflow.com
JTableHeader tableHeader = toPrint.getTableHeader();
tableHeader.setSize(tableHeader.getPreferredSize());
toPrint.print(JTable.PrintMode.FIT_WIDTH);
} catch (PrinterException ex) {
ex.printStackTrace();
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-common
/**
* Methode qui ajoute le tableau jtable dans le fichier pdf
* @param jtable
* @author Adrien Hadoux
*/
public static void addJTableToPdf(JTable _tableToadd,PdfWriter _writer){
PdfContentByte cb = _writer.getDirectContent();
cb.saveState();
Graphics2D g2 = cb.createGraphicsShapes(500, 500);
cb.createGraphics(500, 500);
Shape oldClip = g2.getClip();
g2.clipRect(0, 0, 500, 500);
_tableToadd.print(g2);
g2.setClip(oldClip);
g2.dispose();
cb.restoreState();
}
代码示例来源:origin: stackoverflow.com
public void actionPerformed(final ActionEvent arg0) {
try {
table.print();
} catch (PrinterException e) {
代码示例来源:origin: stackoverflow.com
JTableHeader tableHeader = toPrint.getTableHeader();
tableHeader.setSize(tableHeader.getPreferredSize());
toPrint.print(JTable.PrintMode.FIT_WIDTH);
} catch (PrinterException ex) {
ex.printStackTrace();
内容来源于网络,如有侵权,请联系作者删除!