Incrementando impressao JTable tem como?

0 respostas
furacao123

gostaria de saber se é possivel adicionar mais de uma linha de cabeçalho em um impressão de JTable e tambem customizar a font(tamanho, cor) etc...

alguem poderia me ajudar?? segue o metodo responsavel pela impressão
private void printTable(String cabecalho) {
        MessageFormat headerFmt;
        MessageFormat footerFmt;
        JTable.PrintMode printMode = JTable.PrintMode.FIT_WIDTH ;


        String text;
        text = cabecalho;
        if (text != null && text.length() > 0) {
            headerFmt = new MessageFormat(text);
        } else {
            headerFmt = null;
        }

        text = "";
        if (text != null && text.length() > 0) {
            footerFmt = new MessageFormat(text);
        } else {
            footerFmt = null;
        }

        try {
            boolean status = tbCartaoPonto.print(printMode, headerFmt, footerFmt);

            if (status) {
                JOptionPane.showMessageDialog(tbCartaoPonto.getParent(),
                                              //getString("TableDemo.printingComplete"),
                                              //getString("TableDemo.printingResult"),
                                              JOptionPane.INFORMATION_MESSAGE);
            } else {
                JOptionPane.showMessageDialog(tbCartaoPonto.getParent(),
                                              //getString("TableDemo.printingCancelled"),
                                              //getString("TableDemo.printingResult"),
                                              JOptionPane.INFORMATION_MESSAGE);
            }
        } catch (PrinterException pe) {
            String errorMessage = "ERRO2";/*MessageFormat.format(getString("TableDemo.printingFailed"),
                                                       new Object[] {pe.getMessage()});*/
            JOptionPane.showMessageDialog(tbCartaoPonto.getParent(),
                                          errorMessage,"ALGUMA COISA",
                                          //getString("TableDemo.printingResult"),
                                          JOptionPane.ERROR_MESSAGE);
        } catch (SecurityException se) {
            String errorMessage = "ERRO";/*MessageFormat.format(getString("TableDemo.printingFailed"),
                                                       new Object[] {se.getMessage()});*/
            JOptionPane.showMessageDialog(tbCartaoPonto.getParent(),
                                          errorMessage,"ALGUMA OUTRA COISA",
                                          //getString("TableDemo.printingResult"),
                                          JOptionPane.ERROR_MESSAGE);
        }
    }

ja tentei quebrar a String do cabecalho com "\n" mas nao deu certo...

Criado 3 de fevereiro de 2009
Respostas 0
Participantes 1