Mensagens enviadas por: von.juliano
Índice dos Fóruns » Perfil de von.juliano » Mensagens enviadas por von.juliano
Autor Mensagem
Coloca seu código aí pra gente poder dar uma olhada.
Olha só, eu peguei o seu código e adaptei, por causa das suas classes e etc. Tá aí, funcionando direitinho, vc só tem q adaptar da forma q vc precisa:

/****************************************************************/
/* TabbedComponente */
/* */
/****************************************************************/
import java.awt.*;

import javax.swing.*;
import javax.swing.event.ChangeEvent;

public class TabbedComponent extends JPanel {
// Variables declaration
private final Color corDefault = new Color(0, 0, 0).blue;

private JFrame framePai;

private JTabbedPane jTabbedPane2;

private JPanel contentPane;

private JPanel jPanel4;

private JPanel jPanel5;

Dimension d, e = new Dimension();

public void paintComponent(Graphics g) {
d = framePai.getSize();

if (e.width != d.width || e.height != d.height) {
this.remove(contentPane);
dimensionando();
}
}

public TabbedComponent(JFrame framePai) {
super();
initializeComponent(framePai);

this.setVisible(true);
}

private void initializeComponent(JFrame framePai) {
this.setBackground(corDefault);
this.framePai = framePai;
jTabbedPane2 = new JTabbedPane();
jTabbedPane2.setBackground(corDefault);

JTabbedPane b = new JTabbedPane();

contentPane = this;
contentPane.setBackground(corDefault);
// -----
jPanel4 = new JPanel();
jPanel4.setBackground(corDefault);
jPanel4.add(new JPanel());

jPanel5 = new JPanel();
jPanel5.setBackground(corDefault);
jPanel5.add(new JPanel());

jTabbedPane2.addTab("Analise Web", jPanel4);
jTabbedPane2.addTab("Analise Local", jPanel5);


contentPane.setLayout(new GridLayout());

d = framePai.getSize();
dimensionando();


jPanel4.setLayout(new CardLayout());

jPanel5.setLayout(new CardLayout());
//

}

/** Add Component Without a Layout Manager (Absolute Positioning) */
private void addComponent(Container container, Component c, int x, int y,
int width, int height) {
c.setBounds(x, y, width, height);
container.add(c);
}

private void jTabbedPane2_stateChanged(ChangeEvent e) {

System.out
.println("\njTabbedPane2_stateChanged(ChangeEvent e) called.");
// TODO: Add any handling code here

}

public void dimensionando(){
e=d;
addComponent(contentPane, jTabbedPane2, 0,0,d.width-8,d.height-317);
}

// Só para teste
public static void main(String[] args) {
JFrame f = new JFrame();
TabbedComponent t = new TabbedComponent(new JFrame());
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setLayout(new GridLayout(1,1));
f.setSize(800, 600);
f.add(t);
f.setVisible(true);
System.out.println("Teste");
}
}


Blz!
Olha só, o programa tá aí:


public class Teste {
public void geraRelatorio() throws JRException {
TesteDTO dto = new TesteDTO();
dto.setNome("david");
dto.setValor("100");

Collection col = new ArrayList();
col.add(dto);

JRBeanCollectionDataSource jrbc = new JRBeanCollectionDataSource(col);

Map parameters = new HashMap();
JasperFillManager.fillReportToFile("teste.jasper", "teste.html",parameters, jrbc);
JasperExportManager.exportReportToHtmlFile("teste.html");

JasperViewer.viewReport("teste.html",

}

public static void main(String[] args) throws JRException {
new Teste().geraRelatorio();
}
}
Cara, põe o código aí.
Corrija essa linha e deixe assim:

JasperFillManager.fillReportToFile("teste.jasper", "teste.html", parameters, jrbc);


Cara, dá uma olhada na documentação Jasper, tem um monte de assinaturas do método fillReportToFile, algum vai ter que funcionar!!!

Corrija essas linhas e deixe assim:

JasperPrint rel = JasperFillManager.fillReportToFile("teste.jasper", parameters, jrbc);
JasperExportManager.exportReportToHtmlFile("teste.html");

Vê se agora vai!
Esse painel só contem o JTabbedPane? Pq se for assim, vc pode setar o layout do painel para gridlayou, 1 X 1, que ele vai colocar só o tab no painel ocupando todo o espaço, redimensionando ele junto, caso o painel tb seja.
Foi mal cara, agora que eu achei o erro!

É o seguinte, mantenha a linha q eu te passei e corrija as seguintes linhas correspondentes assim:


JasperPrint rel = JasperFillManager.fillReport("teste.jasper",
parameters, jrbc);

JasperViewer.viewReport(rel, false);


Vê se funciona agora, ele naum vai gerar o .jrprint direto, ams é só vc dar um salvar que ele gera! Tenta aí!
O arquivo .jrprint é gerado quando vc já está visualizando o relatório e manda salvá-lo. Mude essa linha e deixe dessa forma:


JasperExportManager.exportReportToHtmlFile("teste.html");


Agora vê se funciona
O q vc tá usando? Netbeans ou eclipse?
Isso acontece por causa do layout que vc está usando no painel (vc deve estar usando o layout nullo) no qual vc coloca o JTabbedPane. Tente colocar o layout desse painel como GridLayout e vê se funciona como vc quer.
Cara, eu tenho a 4.ª edição e tb já pude dar uma lida na 6.ª. Em princípio os 2 são iguais, porém a 6.ª edição trás uns exemplos mais atuais, baseado em java 1.5, enquanto o outro usa java 1.4 nos exemplos, e além disso, a 6.ª edição está melhor estruturada, quanto à ordem de conteúdo.

Eu voto pela 6.ª edição
JPA ao qual vc se refere é o Jasper Reports?
Você vai em Iniciar > Configurações > Painel de Controle > Ferramentas Administrativas > Serviços.

Aí é só ver na aba status se o serviço que vc quer está rodando, blz!
Não acho uma boa idéia. Dificilmente vc vai precisar um vetor de 2 dimensões, quanto mais com 3 ou 4, então evite fazer isso, use no máximo 2.

Dá uma olhada aqui:
http://java.sun.com/j2se/1.5.0/docs/api/

Procure por pelas Collections, vc vai encontrar uma série de formas diferentes de armazenar seus dados, aí é só utilizar a que lhe for mais útil!
 
Índice dos Fóruns » Perfil de von.juliano » Mensagens enviadas por von.juliano
Ir para:   
Powered by JForum 2.1.8 © JForum Team